step10
Class mini

java.lang.Object
  extended by step10.mini

public class mini
extends Object

a little lexically scoped language to study the typing of variables.


Nested Class Summary
static interface mini.yyActions
          interface between grammar and actions.
static class mini.yyException
          thrown for irrecoverable syntax errors and stack overflow.
static interface mini.yyInput
          must be implemented by a scanner object to supply input to the parser.
static class mini.yyLex
           
static class mini.yyTree
          tree factory.
 
Field Summary
static int __begin
           
static int __else
           
static int __end
           
static int __if
           
static int __in
           
static int __let
           
static int __letrec
           
static int __then
           
static int _0
           
static int _1
           
static int _2
           
static int _3
           
static int _4
           
static int _5
           
static int _6
           
static int _7
           
static int Bool
           
static int Id
           
static int Int
           
static int Real
           
static int Text
           
static int TypeId
           
protected  mini.yyActions yyAct
          current factory.
protected static short[] yyCheck
          parser tables.
protected static short[] yyDefRed
          parser tables.
protected static short[] yyDgoto
          parser tables.
static int yyErrorCode
           
protected static int yyFinal
          number of final state.
protected static short[] yyGindex
          parser tables.
protected static short[] yyLen
          parser tables.
protected static short[] yyLhs
          parser tables.
protected  int yyMax
          initial size and increment of the state/value stack [default 256].
protected static String[] yyNames
          maps symbol value to printable name.
protected static short[] yyRindex
          parser tables.
protected static short[] yySindex
          parser tables.
protected static short[] yyTable
          parser tables.
 
Constructor Summary
mini()
           
 
Method Summary
static void main(String[] args)
          main program to test parser and tree factory.
protected  Object yyDefault(Object first)
          executed at the beginning of a reduce action.
 void yyerror(String message)
          simplified error message.
 void yyerror(String message, String[] expected)
          (syntax) error message.
protected  String[] yyExpecting(int state)
          computes list of expected tokens on error by tracing the tables.
 Object yyparse(mini.yyInput yyLex)
          the generated parser.
 ArrayList yyparse(mini.yyInput yyLex, mini.yyActions yyAct)
          entry point for parser without trace.
 Object yyparse(mini.yyInput yyLex, Object yydebug)
          the generated parser, with debugging messages.
 ArrayList yyparse(mini.yyInput yyLex, Object yydebug, mini.yyActions yyAct)
          entry point for parser with trace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

yyAct

protected mini.yyActions yyAct
current factory.


Bool

public static final int Bool
See Also:
Constant Field Values

Id

public static final int Id
See Also:
Constant Field Values

Int

public static final int Int
See Also:
Constant Field Values

Real

public static final int Real
See Also:
Constant Field Values

Text

public static final int Text
See Also:
Constant Field Values

TypeId

public static final int TypeId
See Also:
Constant Field Values

_0

public static final int _0
See Also:
Constant Field Values

_1

public static final int _1
See Also:
Constant Field Values

_2

public static final int _2
See Also:
Constant Field Values

_3

public static final int _3
See Also:
Constant Field Values

_4

public static final int _4
See Also:
Constant Field Values

_5

public static final int _5
See Also:
Constant Field Values

_6

public static final int _6
See Also:
Constant Field Values

_7

public static final int _7
See Also:
Constant Field Values

__begin

public static final int __begin
See Also:
Constant Field Values

__else

public static final int __else
See Also:
Constant Field Values

__end

public static final int __end
See Also:
Constant Field Values

__if

public static final int __if
See Also:
Constant Field Values

__in

public static final int __in
See Also:
Constant Field Values

__let

public static final int __let
See Also:
Constant Field Values

__letrec

public static final int __letrec
See Also:
Constant Field Values

__then

public static final int __then
See Also:
Constant Field Values

yyErrorCode

public static final int yyErrorCode
See Also:
Constant Field Values

yyFinal

protected static final int yyFinal
number of final state.

See Also:
Constant Field Values

yyLhs

protected static final short[] yyLhs
parser tables. Order is mandated by jay.


yyLen

protected static final short[] yyLen
parser tables. Order is mandated by jay.


yyDefRed

protected static final short[] yyDefRed
parser tables. Order is mandated by jay.


yyDgoto

protected static final short[] yyDgoto
parser tables. Order is mandated by jay.


yySindex

protected static final short[] yySindex
parser tables. Order is mandated by jay.


yyRindex

protected static final short[] yyRindex
parser tables. Order is mandated by jay.


yyGindex

protected static final short[] yyGindex
parser tables. Order is mandated by jay.


yyTable

protected static final short[] yyTable
parser tables. Order is mandated by jay.


yyCheck

protected static final short[] yyCheck
parser tables. Order is mandated by jay.


yyNames

protected static final String[] yyNames
maps symbol value to printable name.

See Also:
yyExpecting(int)

yyMax

protected int yyMax
initial size and increment of the state/value stack [default 256]. This is not final so that it can be overwritten outside of invocations of yyparse(step10.mini.yyInput, java.lang.Object, step10.mini.yyActions).

Constructor Detail

mini

public mini()
Method Detail

yyparse

public ArrayList yyparse(mini.yyInput yyLex,
                         Object yydebug,
                         mini.yyActions yyAct)
                  throws IOException,
                         mini.yyException
entry point for parser with trace.

Throws:
IOException
mini.yyException

yyparse

public ArrayList yyparse(mini.yyInput yyLex,
                         mini.yyActions yyAct)
                  throws IOException,
                         mini.yyException
entry point for parser without trace.

Throws:
IOException
mini.yyException

yyerror

public void yyerror(String message)
simplified error message.

See Also:
yyerror(java.lang.String, java.lang.String[])

yyerror

public void yyerror(String message,
                    String[] expected)
(syntax) error message. Can be overwritten to control message format.

Parameters:
message - text to be displayed.
expected - list of acceptable tokens, if available.

yyExpecting

protected String[] yyExpecting(int state)
computes list of expected tokens on error by tracing the tables.

Parameters:
state - for which to compute the list.
Returns:
list of token names.

yyparse

public Object yyparse(mini.yyInput yyLex,
                      Object yydebug)
               throws IOException,
                      mini.yyException
the generated parser, with debugging messages. Maintains a dynamic state and value stack.

Parameters:
yyLex - scanner.
yydebug - debug message writer implementing yyDebug, or null.
Returns:
result of the last reduction, if any.
Throws:
mini.yyException - on irrecoverable parse error.
IOException

yyDefault

protected Object yyDefault(Object first)
executed at the beginning of a reduce action. Used as $$ = yyDefault($1), prior to the user-specified action, if any. Can be overwritten to provide deep copy, etc.

Parameters:
first - value for $1, or null.
Returns:
first.

yyparse

public Object yyparse(mini.yyInput yyLex)
               throws IOException,
                      mini.yyException
the generated parser. Maintains a dynamic state and value stack.

Parameters:
yyLex - scanner.
Returns:
result of the last reduction, if any.
Throws:
mini.yyException - on irrecoverable parse error.
IOException

main

public static void main(String[] args)
                 throws mini.yyException,
                        IOException
main program to test parser and tree factory. static scanner.

Throws:
mini.yyException
IOException