step3
Class badIf

java.lang.Object
  extended by step3.badIf

public class badIf
extends Object

invalid lexical analysis for lines with open if statements and arithmetic expressions with identifiers. Problem: rules for macro references are generated in order of appearance.


Nested Class Summary
static class badIf.yyException
          thrown for irrecoverable syntax errors and stack overflow.
static interface badIf.yyInput
          must be implemented by a scanner object to supply input to the parser.
static class badIf.yyLex
           
 
Field Summary
static int ELSE
           
static int Id
           
static int IF
           
static int Number
           
static int THEN
           
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
badIf()
           
 
Method Summary
static void main(String[] args)
          main program to test parser.
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(badIf.yyInput yyLex)
          the generated parser.
 Object yyparse(badIf.yyInput yyLex, Object yydebug)
          the generated parser, with debugging messages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ELSE

public static final int ELSE
See Also:
Constant Field Values

IF

public static final int IF
See Also:
Constant Field Values

Id

public static final int Id
See Also:
Constant Field Values

Number

public static final int Number
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(step3.badIf.yyInput, java.lang.Object).

Constructor Detail

badIf

public badIf()
Method Detail

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(badIf.yyInput yyLex,
                      Object yydebug)
               throws IOException,
                      badIf.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:
badIf.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(badIf.yyInput yyLex)
               throws IOException,
                      badIf.yyException
the generated parser. Maintains a dynamic state and value stack.

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

main

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

Throws:
badIf.yyException
IOException