//---------------------------------------------------- // The following code was generated by CUP v0.10k // Wed May 03 15:15:05 NZST 2006 //---------------------------------------------------- package grammar; import text.*; import node.*; import node.stmtNode.*; import node.exprNode.*; import node.exprNode.prefixNode.*; import node.exprNode.valueNode.*; import node.exprNode.binaryNode.*; import node.exprNode.binaryNode.arithNode.*; import node.exprNode.binaryNode.relationNode.*; import node.exprNode.binaryNode.boolNode.*; import java.io.*; import java_cup.runtime.*; /** CUP v0.10k generated parser. * @version Wed May 03 15:15:05 NZST 2006 */ 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\053\000\002\002\004\000\002\003\003\000\002\004" + "\003\000\002\004\004\000\002\005\011\000\002\005\006" + "\000\002\005\005\000\002\005\004\000\002\012\003\000" + "\002\013\005\000\002\013\003\000\002\014\005\000\002" + "\014\003\000\002\015\005\000\002\015\005\000\002\015" + "\005\000\002\015\005\000\002\015\005\000\002\015\005" + "\000\002\015\003\000\002\016\005\000\002\016\005\000" + "\002\016\003\000\002\017\005\000\002\017\005\000\002" + "\017\003\000\002\020\004\000\002\020\004\000\002\020" + "\003\000\002\021\005\000\002\021\003\000\002\021\003" + "\000\002\021\003\000\002\021\006\000\002\021\011\000" + "\002\010\002\000\002\010\003\000\002\011\003\000\002" + "\011\005\000\002\006\002\000\002\006\003\000\002\007" + "\003\000\002\007\005" }); /** Access to production table. */ public short[][] production_table() {return _production_table;} /** Parse-action table. */ protected static final short[][] _action_table = unpackFromStrings(new String[] { "\000\120\000\010\003\006\004\005\035\010\001\002\000" + "\004\002\122\001\002\000\020\005\030\011\020\016\015" + "\024\032\033\022\034\024\035\016\001\002\000\004\013" + "\117\001\002\000\012\002\uffff\003\uffff\004\uffff\035\uffff" + "\001\002\000\006\011\013\021\014\001\002\000\012\002" + "\000\003\006\004\005\035\010\001\002\000\012\002\ufffe" + "\003\ufffe\004\ufffe\035\ufffe\001\002\000\006\012\uffde\035" + "\110\001\002\000\020\005\030\011\020\016\015\024\032" + "\033\022\034\024\035\016\001\002\000\020\005\030\011" + "\020\016\015\024\032\033\022\034\024\035\016\001\002" + "\000\050\006\uffe1\007\uffe1\010\uffe1\011\076\012\uffe1\013" + "\uffe1\014\uffe1\015\uffe1\016\uffe1\017\uffe1\020\uffe1\022\uffe1" + "\023\uffe1\025\uffe1\026\uffe1\027\uffe1\030\uffe1\031\uffe1\032" + "\uffe1\001\002\000\004\013\075\001\002\000\020\005\030" + "\011\020\016\015\024\032\033\022\034\024\035\016\001" + "\002\000\022\006\ufff5\007\ufff5\010\ufff5\012\ufff5\013\ufff5" + "\014\ufff5\022\ufff5\023\ufff5\001\002\000\046\006\uffe3\007" + "\uffe3\010\uffe3\012\uffe3\013\uffe3\014\uffe3\015\uffe3\016\uffe3" + "\017\uffe3\020\uffe3\022\uffe3\023\uffe3\025\uffe3\026\uffe3\027" + "\uffe3\030\uffe3\031\uffe3\032\uffe3\001\002\000\046\006\uffe8" + "\007\uffe8\010\uffe8\012\uffe8\013\uffe8\014\uffe8\015\uffe8\016" + "\uffe8\017\uffe8\020\uffe8\022\uffe8\023\uffe8\025\uffe8\026\uffe8" + "\027\uffe8\030\uffe8\031\uffe8\032\uffe8\001\002\000\046\006" + "\uffe2\007\uffe2\010\uffe2\012\uffe2\013\uffe2\014\uffe2\015\uffe2" + "\016\uffe2\017\uffe2\020\uffe2\022\uffe2\023\uffe2\025\uffe2\026" + "\uffe2\027\uffe2\030\uffe2\031\uffe2\032\uffe2\001\002\000\042" + "\006\uffee\007\uffee\010\uffee\012\uffee\013\uffee\014\uffee\015" + "\056\016\060\022\uffee\023\uffee\025\053\026\055\027\057" + "\030\061\031\054\032\062\001\002\000\046\006\uffeb\007" + "\uffeb\010\uffeb\012\uffeb\013\uffeb\014\uffeb\015\uffeb\016\uffeb" + "\017\050\020\047\022\uffeb\023\uffeb\025\uffeb\026\uffeb\027" + "\uffeb\030\uffeb\031\uffeb\032\uffeb\001\002\000\022\006\ufff7" + "\007\ufff7\010\ufff7\012\ufff7\013\ufff7\014\ufff7\022\ufff7\023" + "\037\001\002\000\020\005\030\011\020\016\015\024\032" + "\033\022\034\024\035\016\001\002\000\020\006\ufff9\007" + "\ufff9\010\ufff9\012\ufff9\013\ufff9\014\ufff9\022\035\001\002" + "\000\020\005\030\011\020\016\015\024\032\033\022\034" + "\024\035\016\001\002\000\046\006\uffe5\007\uffe5\010\uffe5" + "\012\uffe5\013\uffe5\014\uffe5\015\uffe5\016\uffe5\017\uffe5\020" + "\uffe5\022\uffe5\023\uffe5\025\uffe5\026\uffe5\027\uffe5\030\uffe5" + "\031\uffe5\032\uffe5\001\002\000\046\006\uffe6\007\uffe6\010" + "\uffe6\012\uffe6\013\uffe6\014\uffe6\015\uffe6\016\uffe6\017\uffe6" + "\020\uffe6\022\uffe6\023\uffe6\025\uffe6\026\uffe6\027\uffe6\030" + "\uffe6\031\uffe6\032\uffe6\001\002\000\020\005\030\011\020" + "\016\015\024\032\033\022\034\024\035\016\001\002\000" + "\022\006\ufff8\007\ufff8\010\ufff8\012\ufff8\013\ufff8\014\ufff8" + "\022\ufff8\023\037\001\002\000\020\005\030\011\020\016" + "\015\024\032\033\022\034\024\035\016\001\002\000\022" + "\006\ufff6\007\ufff6\010\ufff6\012\ufff6\013\ufff6\014\ufff6\022" + "\ufff6\023\ufff6\001\002\000\004\006\042\001\002\000\020" + "\005\030\011\020\016\015\024\032\033\022\034\024\035" + "\016\001\002\000\004\007\044\001\002\000\020\005\030" + "\011\020\016\015\024\032\033\022\034\024\035\016\001" + "\002\000\004\010\046\001\002\000\046\006\uffdf\007\uffdf" + "\010\uffdf\012\uffdf\013\uffdf\014\uffdf\015\uffdf\016\uffdf\017" + "\uffdf\020\uffdf\022\uffdf\023\uffdf\025\uffdf\026\uffdf\027\uffdf" + "\030\uffdf\031\uffdf\032\uffdf\001\002\000\020\005\030\011" + "\020\016\015\024\032\033\022\034\024\035\016\001\002" + "\000\020\005\030\011\020\016\015\024\032\033\022\034" + "\024\035\016\001\002\000\046\006\uffea\007\uffea\010\uffea" + "\012\uffea\013\uffea\014\uffea\015\uffea\016\uffea\017\uffea\020" + "\uffea\022\uffea\023\uffea\025\uffea\026\uffea\027\uffea\030\uffea" + "\031\uffea\032\uffea\001\002\000\046\006\uffe9\007\uffe9\010" + "\uffe9\012\uffe9\013\uffe9\014\uffe9\015\uffe9\016\uffe9\017\uffe9" + "\020\uffe9\022\uffe9\023\uffe9\025\uffe9\026\uffe9\027\uffe9\030" + "\uffe9\031\uffe9\032\uffe9\001\002\000\020\005\030\011\020" + "\016\015\024\032\033\022\034\024\035\016\001\002\000" + "\020\005\030\011\020\016\015\024\032\033\022\034\024" + "\035\016\001\002\000\020\005\030\011\020\016\015\024" + "\032\033\022\034\024\035\016\001\002\000\020\005\030" + "\011\020\016\015\024\032\033\022\034\024\035\016\001" + "\002\000\020\005\030\011\020\016\015\024\032\033\022" + "\034\024\035\016\001\002\000\020\005\030\011\020\016" + "\015\024\032\033\022\034\024\035\016\001\002\000\020" + "\005\030\011\020\016\015\024\032\033\022\034\024\035" + "\016\001\002\000\020\005\030\011\020\016\015\024\032" + "\033\022\034\024\035\016\001\002\000\026\006\uffef\007" + "\uffef\010\uffef\012\uffef\013\uffef\014\uffef\015\056\016\060" + "\022\uffef\023\uffef\001\002\000\026\006\ufff1\007\ufff1\010" + "\ufff1\012\ufff1\013\ufff1\014\ufff1\015\056\016\060\022\ufff1" + "\023\ufff1\001\002\000\046\006\uffec\007\uffec\010\uffec\012" + "\uffec\013\uffec\014\uffec\015\uffec\016\uffec\017\050\020\047" + "\022\uffec\023\uffec\025\uffec\026\uffec\027\uffec\030\uffec\031" + "\uffec\032\uffec\001\002\000\026\006\ufff2\007\ufff2\010\ufff2" + "\012\ufff2\013\ufff2\014\ufff2\015\056\016\060\022\ufff2\023" + "\ufff2\001\002\000\046\006\uffed\007\uffed\010\uffed\012\uffed" + "\013\uffed\014\uffed\015\uffed\016\uffed\017\050\020\047\022" + "\uffed\023\uffed\025\uffed\026\uffed\027\uffed\030\uffed\031\uffed" + "\032\uffed\001\002\000\026\006\ufff3\007\ufff3\010\ufff3\012" + "\ufff3\013\ufff3\014\ufff3\015\056\016\060\022\ufff3\023\ufff3" + "\001\002\000\026\006\ufff0\007\ufff0\010\ufff0\012\ufff0\013" + "\ufff0\014\ufff0\015\056\016\060\022\ufff0\023\ufff0\001\002" + "\000\026\006\ufff4\007\ufff4\010\ufff4\012\ufff4\013\ufff4\014" + "\ufff4\015\056\016\060\022\ufff4\023\ufff4\001\002\000\004" + "\012\074\001\002\000\046\006\uffe4\007\uffe4\010\uffe4\012" + "\uffe4\013\uffe4\014\uffe4\015\uffe4\016\uffe4\017\uffe4\020\uffe4" + "\022\uffe4\023\uffe4\025\uffe4\026\uffe4\027\uffe4\030\uffe4\031" + "\uffe4\032\uffe4\001\002\000\012\002\ufffc\003\ufffc\004\ufffc" + "\035\ufffc\001\002\000\022\005\030\011\020\012\uffda\016" + "\015\024\032\033\022\034\024\035\016\001\002\000\010" + "\012\uffd8\013\uffd8\014\uffd8\001\002\000\006\012\uffd9\014" + "\103\001\002\000\004\012\102\001\002\000\046\006\uffe0" + "\007\uffe0\010\uffe0\012\uffe0\013\uffe0\014\uffe0\015\uffe0\016" + "\uffe0\017\uffe0\020\uffe0\022\uffe0\023\uffe0\025\uffe0\026\uffe0" + "\027\uffe0\030\uffe0\031\uffe0\032\uffe0\001\002\000\020\005" + "\030\011\020\016\015\024\032\033\022\034\024\035\016" + "\001\002\000\010\012\uffd7\013\uffd7\014\uffd7\001\002\000" + "\046\006\uffe7\007\uffe7\010\uffe7\012\uffe7\013\uffe7\014\uffe7" + "\015\uffe7\016\uffe7\017\uffe7\020\uffe7\022\uffe7\023\uffe7\025" + "\uffe7\026\uffe7\027\uffe7\030\uffe7\031\uffe7\032\uffe7\001\002" + "\000\006\012\uffdd\014\115\001\002\000\004\012\111\001" + "\002\000\006\012\uffdc\014\uffdc\001\002\000\004\021\112" + "\001\002\000\020\005\030\011\020\016\015\024\032\033" + "\022\034\024\035\016\001\002\000\004\013\114\001\002" + "\000\012\002\ufffd\003\ufffd\004\ufffd\035\ufffd\001\002\000" + "\004\035\116\001\002\000\006\012\uffdb\014\uffdb\001\002" + "\000\012\002\ufffa\003\ufffa\004\ufffa\035\ufffa\001\002\000" + "\006\013\121\014\103\001\002\000\012\002\ufffb\003\ufffb" + "\004\ufffb\035\ufffb\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\120\000\010\003\003\004\010\005\006\001\001\000" + "\002\001\001\000\024\007\117\012\076\013\030\014\026" + "\015\020\016\024\017\025\020\022\021\032\001\001\000" + "\002\001\001\000\002\001\001\000\002\001\001\000\004" + "\005\011\001\001\000\002\001\001\000\006\010\106\011" + "\105\001\001\000\022\012\016\013\030\014\026\015\020" + "\016\024\017\025\020\022\021\032\001\001\000\006\020" + "\104\021\032\001\001\000\002\001\001\000\002\001\001" + "\000\022\012\072\013\030\014\026\015\020\016\024\017" + "\025\020\022\021\032\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\022\012\040" + "\013\030\014\026\015\020\016\024\017\025\020\022\021" + "\032\001\001\000\002\001\001\000\006\020\033\021\032" + "\001\001\000\002\001\001\000\002\001\001\000\016\014" + "\035\015\020\016\024\017\025\020\022\021\032\001\001" + "\000\002\001\001\000\014\015\037\016\024\017\025\020" + "\022\021\032\001\001\000\002\001\001\000\002\001\001" + "\000\022\012\042\013\030\014\026\015\020\016\024\017" + "\025\020\022\021\032\001\001\000\002\001\001\000\022" + "\012\044\013\030\014\026\015\020\016\024\017\025\020" + "\022\021\032\001\001\000\002\001\001\000\002\001\001" + "\000\006\020\051\021\032\001\001\000\006\020\050\021" + "\032\001\001\000\002\001\001\000\002\001\001\000\012" + "\016\071\017\025\020\022\021\032\001\001\000\012\016" + "\070\017\025\020\022\021\032\001\001\000\012\016\067" + "\017\025\020\022\021\032\001\001\000\010\017\066\020" + "\022\021\032\001\001\000\012\016\065\017\025\020\022" + "\021\032\001\001\000\010\017\064\020\022\021\032\001" + "\001\000\012\016\063\017\025\020\022\021\032\001\001" + "\000\012\016\062\017\025\020\022\021\032\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\026\006\100\007\077\012\076\013" + "\030\014\026\015\020\016\024\017\025\020\022\021\032" + "\001\001\000\002\001\001\000\002\001\001\000\002\001" + "\001\000\002\001\001\000\022\012\103\013\030\014\026" + "\015\020\016\024\017\025\020\022\021\032\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\022\012" + "\112\013\030\014\026\015\020\016\024\017\025\020\022" + "\021\032\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" }); /** 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 42: // 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(5/*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 41: // 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; ExprListNode exprList = new ExprListNode(); exprList.addElement( expr ); RESULT = exprList; CUP$parser$result = new java_cup.runtime.Symbol(5/*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 40: // ExprListOpt ::= ExprList { ExprListNode RESULT = null; int exprListleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int exprListright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; ExprListNode exprList = (ExprListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; RESULT = exprList; CUP$parser$result = new java_cup.runtime.Symbol(4/*ExprListOpt*/, ((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: // ExprListOpt ::= { ExprListNode RESULT = null; RESULT = new ExprListNode(); CUP$parser$result = new java_cup.runtime.Symbol(4/*ExprListOpt*/, ((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 38: // FormalParamList ::= FormalParamList COMMA IDENT { FormalParamListNode RESULT = null; int formalParamsleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; int formalParamsright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; FormalParamListNode formalParams = (FormalParamListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; 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; formalParams.addElement( ident ); RESULT = formalParams; CUP$parser$result = new java_cup.runtime.Symbol(7/*FormalParamList*/, ((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 37: // FormalParamList ::= IDENT { FormalParamListNode 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; FormalParamListNode formalParams = new FormalParamListNode(); formalParams.addElement( ident ); RESULT = formalParams; CUP$parser$result = new java_cup.runtime.Symbol(7/*FormalParamList*/, ((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: // FormalParamListOpt ::= FormalParamList { FormalParamListNode RESULT = null; int formalParamsleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; int formalParamsright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; FormalParamListNode formalParams = (FormalParamListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; RESULT = formalParams; CUP$parser$result = new java_cup.runtime.Symbol(6/*FormalParamListOpt*/, ((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 35: // FormalParamListOpt ::= { FormalParamListNode RESULT = null; RESULT = new FormalParamListNode(); CUP$parser$result = new java_cup.runtime.Symbol(6/*FormalParamListOpt*/, ((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 34: // Primary ::= IF Expr THEN Expr ELSE Expr FI { ExprNode RESULT = null; int condleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).left; int condright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-5)).right; ExprNode cond = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-5)).value; int expr1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).left; int expr1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-3)).right; ExprNode expr1 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-3)).value; int expr2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; int expr2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ExprNode expr2 = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; RESULT = new IfNode( cond, expr1, expr2 ); CUP$parser$result = new java_cup.runtime.Symbol(15/*Primary*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-6)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 33: // Primary ::= IDENT LEFT ExprListOpt RIGHT { ExprNode 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 actualParamsleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; int actualParamsright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ExprListNode actualParams = (ExprListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; RESULT = new InvocationNode( ident, actualParams ); CUP$parser$result = new java_cup.runtime.Symbol(15/*Primary*/, ((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 32: // 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 VariableNode( ident ); CUP$parser$result = new java_cup.runtime.Symbol(15/*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 31: // Primary ::= STRING { 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 StringNode( Convert.parseString( value.substring( 1, value.length() - 1 ) ) ); CUP$parser$result = new java_cup.runtime.Symbol(15/*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 30: // Primary ::= NUMBER { 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 NumberNode( new Integer( value ) ); CUP$parser$result = new java_cup.runtime.Symbol(15/*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 29: // 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(15/*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 28: // PrefixExpr ::= 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(14/*PrefixExpr*/, ((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: // PrefixExpr ::= NOT PrefixExpr { 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 = new NotNode( expr ); CUP$parser$result = new java_cup.runtime.Symbol(14/*PrefixExpr*/, ((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 26: // PrefixExpr ::= MINUS PrefixExpr { 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 = new NegateNode( expr ); CUP$parser$result = new java_cup.runtime.Symbol(14/*PrefixExpr*/, ((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 25: // MulExpr ::= PrefixExpr { 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(13/*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 24: // MulExpr ::= MulExpr DIVIDE PrefixExpr { 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(13/*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 23: // MulExpr ::= MulExpr TIMES PrefixExpr { 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(13/*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 22: // AddExpr ::= 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(12/*AddExpr*/, ((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 21: // AddExpr ::= AddExpr MINUS MulExpr { 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 MinusNode( expr1, expr2 ); CUP$parser$result = new java_cup.runtime.Symbol(12/*AddExpr*/, ((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 20: // AddExpr ::= AddExpr PLUS MulExpr { 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 PlusNode( expr1, expr2 ); CUP$parser$result = new java_cup.runtime.Symbol(12/*AddExpr*/, ((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 19: // RelExpr ::= AddExpr { 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/*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 18: // RelExpr ::= AddExpr NE AddExpr { 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(11/*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 17: // RelExpr ::= AddExpr EQ AddExpr { 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(11/*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 16: // RelExpr ::= AddExpr GE AddExpr { 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(11/*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 15: // RelExpr ::= AddExpr LE AddExpr { 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(11/*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 14: // RelExpr ::= AddExpr GT AddExpr { 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(11/*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 13: // RelExpr ::= AddExpr LT AddExpr { 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(11/*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 12: // AndExpr ::= 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(10/*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 11: // AndExpr ::= AndExpr AND RelExpr { 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(10/*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 10: // 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(9/*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 9: // 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(9/*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 8: // 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(8/*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 7: // 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 6: // Stmt ::= PRINT ExprList SEMICOLON { StmtNode RESULT = null; int exprListleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; int exprListright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; ExprListNode exprList = (ExprListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).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-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); } return CUP$parser$result; /*. . . . . . . . . . . . . . . . . . . .*/ case 5: // 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 4: // Stmt ::= IDENT LEFT FormalParamListOpt RIGHT ASSIGN Expr SEMICOLON { 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 formalParamListOptleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).left; int formalParamListOptright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-4)).right; FormalParamListNode formalParamListOpt = (FormalParamListNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-4)).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 FunctionDeclNode( ident, formalParamListOpt, expr ); CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-6)).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 ::= Stmt { StmtListNode RESULT = null; 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; StmtListNode stmtList = new StmtListNode(); 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-0)).left, ((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"); } } }