//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Tue Mar 27 11:18:03 NZST 2007
//----------------------------------------------------
package grammar;
import node.*;
import node.stmtNode.*;
import node.exprNode.*;
import node.exprNode.valueNode.*;
import node.exprNode.prefixNode.*;
import node.exprNode.binaryNode.*;
import node.exprNode.binaryNode.arithNode.*;
import node.exprNode.binaryNode.boolNode.*;
import node.exprNode.binaryNode.relationNode.*;
import text.*;
import java.io.*;
import java_cup.runtime.*;
/** CUP v0.10k generated parser.
* @version Tue Mar 27 11:18:03 NZST 2007
*/
public class parser extends java_cup.runtime.lr_parser {
/** Default constructor. */
public parser() {super();}
/** Constructor which sets the default scanner. */
public parser(java_cup.runtime.Scanner s) {super(s);}
/** Production table. */
protected static final short _production_table[][] =
unpackFromStrings(new String[] {
"\000\052\000\002\002\004\000\002\003\003\000\002\004" +
"\002\000\002\004\004\000\002\005\006\000\002\005\007" +
"\000\002\005\010\000\002\005\006\000\002\005\006\000" +
"\002\005\012\000\002\005\005\000\002\005\004\000\002" +
"\005\004\000\002\006\003\000\002\006\005\000\002\007" +
"\003\000\002\010\005\000\002\010\003\000\002\011\005" +
"\000\002\011\003\000\002\012\004\000\002\012\003\000" +
"\002\013\005\000\002\013\005\000\002\013\005\000\002" +
"\013\005\000\002\013\005\000\002\013\005\000\002\013" +
"\003\000\002\014\005\000\002\014\005\000\002\014\004" +
"\000\002\014\003\000\002\015\005\000\002\015\005\000" +
"\002\015\003\000\002\016\005\000\002\016\003\000\002" +
"\016\003\000\002\016\003\000\002\016\003\000\002\016" +
"\003" });
/** Access to production table. */
public short[][] production_table() {return _production_table;}
/** Parse-action table. */
protected static final short[][] _action_table =
unpackFromStrings(new String[] {
"\000\124\000\022\002\uffff\003\uffff\023\uffff\024\uffff\027" +
"\uffff\031\uffff\034\uffff\045\uffff\001\002\000\004\002\126" +
"\001\002\000\022\002\000\003\007\023\006\024\015\027" +
"\014\031\011\034\013\045\012\001\002\000\004\036\117" +
"\001\002\000\006\033\115\035\116\001\002\000\024\002" +
"\ufffe\003\ufffe\023\ufffe\024\ufffe\027\ufffe\031\ufffe\034\ufffe" +
"\035\ufffe\045\ufffe\001\002\000\004\045\106\001\002\000" +
"\004\022\103\001\002\000\022\003\uffff\023\uffff\024\uffff" +
"\027\uffff\031\uffff\034\uffff\035\uffff\045\uffff\001\002\000" +
"\022\007\034\017\016\036\020\041\023\042\032\043\033" +
"\044\026\045\017\001\002\000\022\007\034\017\016\036" +
"\020\041\023\042\032\043\033\044\026\045\017\001\002" +
"\000\016\036\020\041\023\042\032\043\033\044\026\045" +
"\017\001\002\000\046\005\uffd8\006\uffd8\010\uffd8\011\uffd8" +
"\012\uffd8\013\uffd8\014\uffd8\015\uffd8\016\uffd8\017\uffd8\020" +
"\uffd8\021\uffd8\025\uffd8\030\uffd8\032\uffd8\033\uffd8\037\uffd8" +
"\040\uffd8\001\002\000\022\007\034\017\016\036\020\041" +
"\023\042\032\043\033\044\026\045\017\001\002\000\004" +
"\025\067\001\002\000\022\005\uffec\006\uffec\025\uffec\030" +
"\uffec\032\uffec\033\uffec\037\uffec\040\uffec\001\002\000\046" +
"\005\uffdc\006\uffdc\010\uffdc\011\uffdc\012\uffdc\013\uffdc\014" +
"\uffdc\015\uffdc\016\uffdc\017\uffdc\020\uffdc\021\uffdc\025\uffdc" +
"\030\uffdc\032\uffdc\033\uffdc\037\uffdc\040\uffdc\001\002\000" +
"\022\005\uffee\006\uffee\025\uffee\030\uffee\032\uffee\033\uffee" +
"\037\uffee\040\uffee\001\002\000\042\005\uffe5\006\uffe5\010" +
"\050\011\053\012\051\013\055\014\047\015\056\016\052" +
"\017\054\025\uffe5\030\uffe5\032\uffe5\033\uffe5\037\uffe5\040" +
"\uffe5\001\002\000\046\005\uffda\006\uffda\010\uffda\011\uffda" +
"\012\uffda\013\uffda\014\uffda\015\uffda\016\uffda\017\uffda\020" +
"\uffda\021\uffda\025\uffda\030\uffda\032\uffda\033\uffda\037\uffda" +
"\040\uffda\001\002\000\046\005\uffe1\006\uffe1\010\uffe1\011" +
"\uffe1\012\uffe1\013\uffe1\014\uffe1\015\uffe1\016\uffe1\017\uffe1" +
"\020\044\021\043\025\uffe1\030\uffe1\032\uffe1\033\uffe1\037" +
"\uffe1\040\uffe1\001\002\000\022\005\ufff0\006\041\025\ufff0" +
"\030\ufff0\032\ufff0\033\ufff0\037\ufff0\040\ufff0\001\002\000" +
"\020\005\037\025\ufff2\030\ufff2\032\ufff2\033\ufff2\037\ufff2" +
"\040\ufff2\001\002\000\046\005\uffdb\006\uffdb\010\uffdb\011" +
"\uffdb\012\uffdb\013\uffdb\014\uffdb\015\uffdb\016\uffdb\017\uffdb" +
"\020\uffdb\021\uffdb\025\uffdb\030\uffdb\032\uffdb\033\uffdb\037" +
"\uffdb\040\uffdb\001\002\000\046\005\uffd9\006\uffd9\010\uffd9" +
"\011\uffd9\012\uffd9\013\uffd9\014\uffd9\015\uffd9\016\uffd9\017" +
"\uffd9\020\uffd9\021\uffd9\025\uffd9\030\uffd9\032\uffd9\033\uffd9" +
"\037\uffd9\040\uffd9\001\002\000\022\007\034\017\016\036" +
"\020\041\023\042\032\043\033\044\026\045\017\001\002" +
"\000\046\005\uffde\006\uffde\010\uffde\011\uffde\012\uffde\013" +
"\uffde\014\uffde\015\uffde\016\uffde\017\uffde\020\uffde\021\uffde" +
"\025\uffde\030\uffde\032\uffde\033\uffde\037\uffde\040\uffde\001" +
"\002\000\022\005\uffed\006\uffed\025\uffed\030\uffed\032\uffed" +
"\033\uffed\037\uffed\040\uffed\001\002\000\022\007\034\017" +
"\016\036\020\041\023\042\032\043\033\044\026\045\017" +
"\001\002\000\022\005\ufff1\006\041\025\ufff1\030\ufff1\032" +
"\ufff1\033\ufff1\037\ufff1\040\ufff1\001\002\000\022\007\034" +
"\017\016\036\020\041\023\042\032\043\033\044\026\045" +
"\017\001\002\000\022\005\uffef\006\uffef\025\uffef\030\uffef" +
"\032\uffef\033\uffef\037\uffef\040\uffef\001\002\000\016\036" +
"\020\041\023\042\032\043\033\044\026\045\017\001\002" +
"\000\016\036\020\041\023\042\032\043\033\044\026\045" +
"\017\001\002\000\046\005\uffe0\006\uffe0\010\uffe0\011\uffe0" +
"\012\uffe0\013\uffe0\014\uffe0\015\uffe0\016\uffe0\017\uffe0\020" +
"\uffe0\021\uffe0\025\uffe0\030\uffe0\032\uffe0\033\uffe0\037\uffe0" +
"\040\uffe0\001\002\000\046\005\uffdf\006\uffdf\010\uffdf\011" +
"\uffdf\012\uffdf\013\uffdf\014\uffdf\015\uffdf\016\uffdf\017\uffdf" +
"\020\uffdf\021\uffdf\025\uffdf\030\uffdf\032\uffdf\033\uffdf\037" +
"\uffdf\040\uffdf\001\002\000\020\017\016\036\020\041\023" +
"\042\032\043\033\044\026\045\017\001\002\000\020\017" +
"\016\036\020\041\023\042\032\043\033\044\026\045\017" +
"\001\002\000\020\017\016\036\020\041\023\042\032\043" +
"\033\044\026\045\017\001\002\000\016\036\020\041\023" +
"\042\032\043\033\044\026\045\017\001\002\000\020\017" +
"\016\036\020\041\023\042\032\043\033\044\026\045\017" +
"\001\002\000\016\036\020\041\023\042\032\043\033\044" +
"\026\045\017\001\002\000\020\017\016\036\020\041\023" +
"\042\032\043\033\044\026\045\017\001\002\000\020\017" +
"\016\036\020\041\023\042\032\043\033\044\026\045\017" +
"\001\002\000\026\005\uffe6\006\uffe6\016\052\017\054\025" +
"\uffe6\030\uffe6\032\uffe6\033\uffe6\037\uffe6\040\uffe6\001\002" +
"\000\026\005\uffe8\006\uffe8\016\052\017\054\025\uffe8\030" +
"\uffe8\032\uffe8\033\uffe8\037\uffe8\040\uffe8\001\002\000\046" +
"\005\uffe3\006\uffe3\010\uffe3\011\uffe3\012\uffe3\013\uffe3\014" +
"\uffe3\015\uffe3\016\uffe3\017\uffe3\020\044\021\043\025\uffe3" +
"\030\uffe3\032\uffe3\033\uffe3\037\uffe3\040\uffe3\001\002\000" +
"\026\005\uffea\006\uffea\016\052\017\054\025\uffea\030\uffea" +
"\032\uffea\033\uffea\037\uffea\040\uffea\001\002\000\046\005" +
"\uffe4\006\uffe4\010\uffe4\011\uffe4\012\uffe4\013\uffe4\014\uffe4" +
"\015\uffe4\016\uffe4\017\uffe4\020\044\021\043\025\uffe4\030" +
"\uffe4\032\uffe4\033\uffe4\037\uffe4\040\uffe4\001\002\000\026" +
"\005\uffe9\006\uffe9\016\052\017\054\025\uffe9\030\uffe9\032" +
"\uffe9\033\uffe9\037\uffe9\040\uffe9\001\002\000\026\005\uffeb" +
"\006\uffeb\016\052\017\054\025\uffeb\030\uffeb\032\uffeb\033" +
"\uffeb\037\uffeb\040\uffeb\001\002\000\026\005\uffe7\006\uffe7" +
"\016\052\017\054\025\uffe7\030\uffe7\032\uffe7\033\uffe7\037" +
"\uffe7\040\uffe7\001\002\000\020\003\007\023\006\024\015" +
"\027\014\031\011\034\013\045\012\001\002\000\026\002" +
"\ufffa\003\ufffa\023\ufffa\024\ufffa\026\071\027\ufffa\031\ufffa" +
"\034\ufffa\035\ufffa\045\ufffa\001\002\000\020\003\007\023" +
"\006\024\015\027\014\031\011\034\013\045\012\001\002" +
"\000\026\002\ufffb\003\ufffb\023\ufffb\024\ufffb\026\ufffb\027" +
"\ufffb\031\ufffb\034\ufffb\035\ufffb\045\ufffb\001\002\000\004" +
"\037\074\001\002\000\046\005\uffdd\006\uffdd\010\uffdd\011" +
"\uffdd\012\uffdd\013\uffdd\014\uffdd\015\uffdd\016\uffdd\017\uffdd" +
"\020\uffdd\021\uffdd\025\uffdd\030\uffdd\032\uffdd\033\uffdd\037" +
"\uffdd\040\uffdd\001\002\000\046\005\uffe2\006\uffe2\010\uffe2" +
"\011\uffe2\012\uffe2\013\uffe2\014\uffe2\015\uffe2\016\uffe2\017" +
"\uffe2\020\044\021\043\025\uffe2\030\uffe2\032\uffe2\033\uffe2" +
"\037\uffe2\040\uffe2\001\002\000\004\030\077\001\002\000" +
"\020\003\007\023\006\024\015\027\014\031\011\034\013" +
"\045\012\001\002\000\026\002\ufff9\003\ufff9\023\ufff9\024" +
"\ufff9\026\ufff9\027\ufff9\031\ufff9\034\ufff9\035\ufff9\045\ufff9" +
"\001\002\000\022\003\007\023\006\024\015\027\014\031" +
"\011\034\013\035\102\045\012\001\002\000\026\002\ufff7" +
"\003\ufff7\023\ufff7\024\ufff7\026\ufff7\027\ufff7\031\ufff7\034" +
"\ufff7\035\ufff7\045\ufff7\001\002\000\022\007\034\017\016" +
"\036\020\041\023\042\032\043\033\044\026\045\017\001" +
"\002\000\004\033\105\001\002\000\026\002\ufffd\003\ufffd" +
"\023\ufffd\024\ufffd\026\ufffd\027\ufffd\031\ufffd\034\ufffd\035" +
"\ufffd\045\ufffd\001\002\000\004\022\107\001\002\000\022" +
"\007\034\017\016\036\020\041\023\042\032\043\033\044" +
"\026\045\017\001\002\000\004\032\111\001\002\000\022" +
"\007\034\017\016\036\020\041\023\042\032\043\033\044" +
"\026\045\017\001\002\000\004\030\113\001\002\000\020" +
"\003\007\023\006\024\015\027\014\031\011\034\013\045" +
"\012\001\002\000\026\002\ufff8\003\ufff8\023\ufff8\024\ufff8" +
"\026\ufff8\027\ufff8\031\ufff8\034\ufff8\035\ufff8\045\ufff8\001" +
"\002\000\026\002\ufff6\003\ufff6\023\ufff6\024\ufff6\026\ufff6" +
"\027\ufff6\031\ufff6\034\ufff6\035\ufff6\045\ufff6\001\002\000" +
"\026\002\ufff5\003\ufff5\023\ufff5\024\ufff5\026\ufff5\027\ufff5" +
"\031\ufff5\034\ufff5\035\ufff5\045\ufff5\001\002\000\022\007" +
"\034\017\016\036\020\041\023\042\032\043\033\044\026" +
"\045\017\001\002\000\006\037\ufff4\040\ufff4\001\002\000" +
"\006\037\123\040\122\001\002\000\022\007\034\017\016" +
"\036\020\041\023\042\032\043\033\044\026\045\017\001" +
"\002\000\004\033\124\001\002\000\026\002\ufffc\003\ufffc" +
"\023\ufffc\024\ufffc\026\ufffc\027\ufffc\031\ufffc\034\ufffc\035" +
"\ufffc\045\ufffc\001\002\000\006\037\ufff3\040\ufff3\001\002" +
"\000\004\002\001\001\002" });
/** Access to parse-action table. */
public short[][] action_table() {return _action_table;}
/** reduce_goto
table. */
protected static final short[][] _reduce_table =
unpackFromStrings(new String[] {
"\000\124\000\006\003\003\004\004\001\001\000\002\001" +
"\001\000\004\005\007\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001\000\002\001\001\000\002\001" +
"\001\000\004\004\100\001\001\000\022\007\075\010\030" +
"\011\027\012\023\013\021\014\024\015\026\016\034\001" +
"\001\000\022\007\020\010\030\011\027\012\023\013\021" +
"\014\024\015\026\016\034\001\001\000\006\015\074\016" +
"\034\001\001\000\002\001\001\000\022\007\072\010\030" +
"\011\027\012\023\013\021\014\024\015\026\016\034\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001\000\002" +
"\001\001\000\002\001\001\000\014\012\035\013\021\014" +
"\024\015\026\016\034\001\001\000\002\001\001\000\002" +
"\001\001\000\016\011\037\012\023\013\021\014\024\015" +
"\026\016\034\001\001\000\002\001\001\000\014\012\041" +
"\013\021\014\024\015\026\016\034\001\001\000\002\001" +
"\001\000\004\016\045\001\001\000\004\016\044\001\001" +
"\000\002\001\001\000\002\001\001\000\010\014\065\015" +
"\026\016\034\001\001\000\010\014\064\015\026\016\034" +
"\001\001\000\010\014\063\015\026\016\034\001\001\000" +
"\006\015\062\016\034\001\001\000\010\014\061\015\026" +
"\016\034\001\001\000\006\015\060\016\034\001\001\000" +
"\010\014\057\015\026\016\034\001\001\000\010\014\056" +
"\015\026\016\034\001\001\000\002\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\002\001\001\000\002\001\001\000" +
"\004\005\067\001\001\000\002\001\001\000\004\005\071" +
"\001\001\000\002\001\001\000\002\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\004\005\077" +
"\001\001\000\002\001\001\000\004\005\007\001\001\000" +
"\002\001\001\000\022\007\103\010\030\011\027\012\023" +
"\013\021\014\024\015\026\016\034\001\001\000\002\001" +
"\001\000\002\001\001\000\002\001\001\000\022\007\107" +
"\010\030\011\027\012\023\013\021\014\024\015\026\016" +
"\034\001\001\000\002\001\001\000\022\007\111\010\030" +
"\011\027\012\023\013\021\014\024\015\026\016\034\001" +
"\001\000\002\001\001\000\004\005\113\001\001\000\002" +
"\001\001\000\002\001\001\000\002\001\001\000\024\006" +
"\120\007\117\010\030\011\027\012\023\013\021\014\024" +
"\015\026\016\034\001\001\000\002\001\001\000\002\001" +
"\001\000\022\007\124\010\030\011\027\012\023\013\021" +
"\014\024\015\026\016\034\001\001\000\002\001\001\000" +
"\002\001\001\000\002\001\001\000\002\001\001" });
/** Access to reduce_goto
table. */
public short[][] reduce_table() {return _reduce_table;}
/** Instance of action encapsulation class. */
protected CUP$parser$actions action_obj;
/** Action encapsulation object initializer. */
protected void init_actions()
{
action_obj = new CUP$parser$actions(this);
}
/** Invoke a user supplied parse action. */
public java_cup.runtime.Symbol do_action(
int act_num,
java_cup.runtime.lr_parser parser,
java.util.Stack stack,
int top)
throws java.lang.Exception
{
/* call code in generated class */
return action_obj.CUP$parser$do_action(act_num, parser, stack, top);
}
/** Indicates start state. */
public int start_state() {return 0;}
/** Indicates start production. */
public int start_production() {return 0;}
/** EOF
Symbol index. */
public int EOF_sym() {return 0;}
/** error
Symbol index. */
public int error_sym() {return 1;}
/** Scan to get the next Symbol. */
public java_cup.runtime.Symbol scan()
throws java.lang.Exception
{
return lexer.yylex();
}
private Yylex lexer;
private File file;
public parser( File file ) {
this();
this.file = file;
try {
lexer = new Yylex( new FileReader( file ) );
}
catch ( IOException exception ) {
throw new Error( "Unable to open file \"" + file + "\"" );
}
}
public String terminal_name( int id ) {
return sym.terminal_name( id );
}
public String non_terminal_name( int id ) {
return sym.non_terminal_name( id );
}
public String rule_name( int id ) {
return sym.rule_name( id );
}
public void report_error( String message, Object info ) {
Print.error().println( file + " ( " + lexer.lineNumber() + " ): " + message );
try {
if ( info instanceof Symbol ) {
Symbol symbol = ( Symbol ) info;
printText( symbol.left, symbol.right );
}
}
catch ( IOException e ) {
}
}
private void printText( int left, int right ) throws IOException {
Reader sourceReader = new FileReader( file );
int veryLeft = Math.max( left - 50, 0 ),
veryRight = Math.min( right + 20,
( int ) file.length() );
char[] text = new char[ veryRight - veryLeft ];
char[] underline = new char[ veryRight - veryLeft ];
sourceReader.skip( veryLeft );
sourceReader.read( text );
for ( int i = 0; i < text.length; i++ ) {
if ( text[ i ] < ' ' ) {
text[ i ] = '|';
underline[ i ] = '|';
}
else
underline[ i ] = ' ';
if ( left <= veryLeft + i && veryLeft + i < right )
underline[ i ] = '^';
}
printLine( text );
printLine( underline );
}
private static void printLine( char[] text ) {
for ( int i = 0; i < text.length; i++ )
Print.error().print( text[ i ] );
Print.error().println();
}
public void syntax_error( Symbol currToken ) {
report_error( "Syntax Error", currToken );
}
}
/** Cup generated class to encapsulate user supplied action code.*/
class CUP$parser$actions {
private final parser parser;
/** Constructor */
CUP$parser$actions(parser parser) {
this.parser = parser;
}
/** Method with the actual generated action code. */
public final java_cup.runtime.Symbol CUP$parser$do_action(
int CUP$parser$act_num,
java_cup.runtime.lr_parser CUP$parser$parser,
java.util.Stack CUP$parser$stack,
int CUP$parser$top)
throws java.lang.Exception
{
/* Symbol object for return from actions */
java_cup.runtime.Symbol CUP$parser$result;
/* select the action based on the action number */
switch (CUP$parser$act_num)
{
/*. . . . . . . . . . . . . . . . . . . .*/
case 41: // Primary ::= IDENT
{
ExprNode RESULT = null;
int identleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int identright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
String ident = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new IdentNode( ident );
CUP$parser$result = new java_cup.runtime.Symbol(12/*Primary*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 40: // Primary ::= STRINGVALUE
{
ExprNode RESULT = null;
int valueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int valueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
String value = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new StringValueNode(
Convert.parseString( value.substring( 1, value.length() - 1 ) ) );
CUP$parser$result = new java_cup.runtime.Symbol(12/*Primary*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 39: // Primary ::= INTVALUE
{
ExprNode RESULT = null;
int valueleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int valueright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
String value = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new IntValueNode( Integer.parseInt( value ) );
CUP$parser$result = new java_cup.runtime.Symbol(12/*Primary*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 38: // Primary ::= FALSE
{
ExprNode RESULT = null;
RESULT = new BoolValueNode( false );
CUP$parser$result = new java_cup.runtime.Symbol(12/*Primary*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 37: // Primary ::= TRUE
{
ExprNode RESULT = null;
RESULT = new BoolValueNode( true );
CUP$parser$result = new java_cup.runtime.Symbol(12/*Primary*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 36: // Primary ::= LEFT Expr RIGHT
{
ExprNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = expr;
CUP$parser$result = new java_cup.runtime.Symbol(12/*Primary*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 35: // MulExpr ::= Primary
{
ExprNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = expr;
CUP$parser$result = new java_cup.runtime.Symbol(11/*MulExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 34: // MulExpr ::= MulExpr DIVIDE Primary
{
ExprNode RESULT = null;
int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new DivideNode( expr1, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(11/*MulExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 33: // MulExpr ::= MulExpr TIMES Primary
{
ExprNode RESULT = null;
int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new TimesNode( expr1, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(11/*MulExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 32: // PlusExpr ::= MulExpr
{
ExprNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = expr;
CUP$parser$result = new java_cup.runtime.Symbol(10/*PlusExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 31: // PlusExpr ::= MINUS MulExpr
{
ExprNode RESULT = null;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new NegateNode( expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(10/*PlusExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 30: // PlusExpr ::= PlusExpr MINUS MulExpr
{
ExprNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new MinusNode( expr, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(10/*PlusExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 29: // PlusExpr ::= PlusExpr PLUS MulExpr
{
ExprNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new PlusNode( expr, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(10/*PlusExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 28: // RelExpr ::= PlusExpr
{
ExprNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = expr;
CUP$parser$result = new java_cup.runtime.Symbol(9/*RelExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 27: // RelExpr ::= PlusExpr NE PlusExpr
{
ExprNode RESULT = null;
int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new NotEqualNode( expr1, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(9/*RelExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 26: // RelExpr ::= PlusExpr EQ PlusExpr
{
ExprNode RESULT = null;
int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new EqualNode( expr1, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(9/*RelExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 25: // RelExpr ::= PlusExpr GE PlusExpr
{
ExprNode RESULT = null;
int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new GreaterEqualNode( expr1, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(9/*RelExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 24: // RelExpr ::= PlusExpr GT PlusExpr
{
ExprNode RESULT = null;
int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new GreaterThanNode( expr1, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(9/*RelExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 23: // RelExpr ::= PlusExpr LE PlusExpr
{
ExprNode RESULT = null;
int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new LessEqualNode( expr1, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(9/*RelExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 22: // RelExpr ::= PlusExpr LT PlusExpr
{
ExprNode RESULT = null;
int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new LessThanNode( expr1, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(9/*RelExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 21: // NotExpr ::= RelExpr
{
ExprNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = expr;
CUP$parser$result = new java_cup.runtime.Symbol(8/*NotExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 20: // NotExpr ::= NOT NotExpr
{
ExprNode RESULT = null;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new NotNode( expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(8/*NotExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 19: // AndExpr ::= NotExpr
{
ExprNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = expr;
CUP$parser$result = new java_cup.runtime.Symbol(7/*AndExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 18: // AndExpr ::= AndExpr AND NotExpr
{
ExprNode RESULT = null;
int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new AndNode( expr1, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(7/*AndExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 17: // OrExpr ::= AndExpr
{
ExprNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = expr;
CUP$parser$result = new java_cup.runtime.Symbol(6/*OrExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 16: // OrExpr ::= OrExpr OR AndExpr
{
ExprNode RESULT = null;
int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new OrNode( expr1, expr2 );
CUP$parser$result = new java_cup.runtime.Symbol(6/*OrExpr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 15: // Expr ::= OrExpr
{
ExprNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = expr;
CUP$parser$result = new java_cup.runtime.Symbol(5/*Expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 14: // ExprList ::= ExprList COMMA Expr
{
ExprListNode RESULT = null;
int exprListleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int exprListright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprListNode exprList = (ExprListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
exprList.addElement( expr );
RESULT = exprList;
CUP$parser$result = new java_cup.runtime.Symbol(4/*ExprList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 13: // ExprList ::= Expr
{
ExprListNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new ExprListNode( expr );
CUP$parser$result = new java_cup.runtime.Symbol(4/*ExprList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 12: // Stmt ::= error RIGHTCURLY
{
StmtNode RESULT = null;
RESULT = new ErrorStmtNode();
CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 11: // Stmt ::= error SEMICOLON
{
StmtNode RESULT = null;
RESULT = new ErrorStmtNode();
CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 10: // Stmt ::= LEFTCURLY StmtList RIGHTCURLY
{
StmtNode RESULT = null;
int stmtListleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int stmtListright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
StmtListNode stmtList = (StmtListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = new CompoundStmtNode( stmtList );
CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 9: // Stmt ::= FOR IDENT ASSIGN Expr TO Expr DO Stmt
{
StmtNode RESULT = null;
int identleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-6)).left;
int identright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-6)).right;
String ident = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-6)).value;
int initExprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left;
int initExprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).right;
ExprNode initExpr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-4)).value;
int finalExprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int finalExprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode finalExpr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int stmtleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int stmtright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
StmtNode stmt = (StmtNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new ForStmtNode( ident, initExpr, finalExpr, stmt );
CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-7)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 8: // Stmt ::= WHILE Expr DO Stmt
{
StmtNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int stmtleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int stmtright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
StmtNode stmt = (StmtNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new WhileStmtNode( expr, stmt );
CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 7: // Stmt ::= IF Expr THEN Stmt
{
StmtNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int thenPartleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int thenPartright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
StmtNode thenPart = (StmtNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new IfThenStmtNode( expr, thenPart );
CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 6: // Stmt ::= IF Expr THEN Stmt ELSE Stmt
{
StmtNode RESULT = null;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-4)).value;
int thenPartleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int thenPartright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
StmtNode thenPart = (StmtNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int elsePartleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int elsePartright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
StmtNode elsePart = (StmtNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new IfThenElseStmtNode( expr, thenPart, elsePart );
CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 5: // Stmt ::= PRINT LEFT ExprList RIGHT SEMICOLON
{
StmtNode RESULT = null;
int exprListleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int exprListright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprListNode exprList = (ExprListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
RESULT = new PrintStmtNode( exprList );
CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 4: // Stmt ::= IDENT ASSIGN Expr SEMICOLON
{
StmtNode RESULT = null;
int identleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left;
int identright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right;
String ident = (String)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value;
int exprleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int exprright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
ExprNode expr = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = new AssignStmtNode( ident, expr );
CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 3: // StmtList ::= StmtList Stmt
{
StmtListNode RESULT = null;
int stmtListleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int stmtListright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
StmtListNode stmtList = (StmtListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
int stmtleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int stmtright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
StmtNode stmt = (StmtNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
stmtList.addElement( stmt );
RESULT = stmtList;
CUP$parser$result = new java_cup.runtime.Symbol(2/*StmtList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 2: // StmtList ::=
{
StmtListNode RESULT = null;
RESULT = new StmtListNode();
CUP$parser$result = new java_cup.runtime.Symbol(2/*StmtList*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 1: // Program ::= StmtList
{
ProgramNode RESULT = null;
int stmtListleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int stmtListright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
StmtListNode stmtList = (StmtListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new ProgramNode( stmtList );
CUP$parser$result = new java_cup.runtime.Symbol(1/*Program*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
return CUP$parser$result;
/*. . . . . . . . . . . . . . . . . . . .*/
case 0: // $START ::= Program EOF
{
Object RESULT = null;
int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left;
int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right;
ProgramNode start_val = (ProgramNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value;
RESULT = start_val;
CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT);
}
/* ACCEPT */
CUP$parser$parser.done_parsing();
return CUP$parser$result;
/* . . . . . .*/
default:
throw new Exception(
"Invalid action number found in internal parse table");
}
}
}