//----------------------------------------------------
// The following code was generated by CUP v0.10k
// Wed May 03 15:14:57 NZST 2006
//----------------------------------------------------
package grammar;
import node.*;
import node.stmtNode.*;
import node.exprNode.*;
import node.exprNode.prefixNode.*;
import node.exprNode.valueNode.*;
import node.exprNode.binaryNode.*;
import text.*;
import java.io.*;
import java_cup.runtime.*;
/** CUP v0.10k generated parser.
* @version Wed May 03 15:14:57 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\022\000\002\002\004\000\002\003\003\000\002\004" +
"\002\000\002\004\004\000\002\005\006\000\002\005\004" +
"\000\002\005\004\000\002\005\003\000\002\006\005\000" +
"\002\006\005\000\002\006\004\000\002\006\003\000\002" +
"\007\005\000\002\007\005\000\002\007\003\000\002\010" +
"\005\000\002\010\003\000\002\010\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\037\000\020\002\uffff\003\uffff\004\uffff\006\uffff\010" +
"\uffff\014\uffff\015\uffff\001\002\000\004\002\041\001\002" +
"\000\020\002\000\003\015\004\011\006\017\010\006\014" +
"\012\015\007\001\002\000\010\004\011\014\012\015\024" +
"\001\002\000\016\006\ufff0\007\ufff0\010\ufff0\011\ufff0\012" +
"\ufff0\013\035\001\002\000\010\006\034\007\027\010\031" +
"\001\002\000\012\004\011\010\006\014\012\015\024\001" +
"\002\000\016\005\ufff1\006\ufff1\007\ufff1\010\ufff1\011\ufff1" +
"\012\ufff1\001\002\000\020\002\ufffe\003\ufffe\004\ufffe\006" +
"\ufffe\010\ufffe\014\ufffe\015\ufffe\001\002\000\016\005\ufff6" +
"\006\ufff6\007\ufff6\010\ufff6\011\022\012\021\001\002\000" +
"\004\006\020\001\002\000\016\005\ufff3\006\ufff3\007\ufff3" +
"\010\ufff3\011\ufff3\012\ufff3\001\002\000\020\002\ufffa\003" +
"\ufffa\004\ufffa\006\ufffa\010\ufffa\014\ufffa\015\ufffa\001\002" +
"\000\020\002\ufffb\003\ufffb\004\ufffb\006\ufffb\010\ufffb\014" +
"\ufffb\015\ufffb\001\002\000\010\004\011\014\012\015\024" +
"\001\002\000\010\004\011\014\012\015\024\001\002\000" +
"\016\005\ufff5\006\ufff5\007\ufff5\010\ufff5\011\ufff5\012\ufff5" +
"\001\002\000\016\005\ufff0\006\ufff0\007\ufff0\010\ufff0\011" +
"\ufff0\012\ufff0\001\002\000\016\005\ufff4\006\ufff4\007\ufff4" +
"\010\ufff4\011\ufff4\012\ufff4\001\002\000\010\005\030\007" +
"\027\010\031\001\002\000\010\004\011\014\012\015\024" +
"\001\002\000\016\005\ufff2\006\ufff2\007\ufff2\010\ufff2\011" +
"\ufff2\012\ufff2\001\002\000\010\004\011\014\012\015\024" +
"\001\002\000\016\005\ufff8\006\ufff8\007\ufff8\010\ufff8\011" +
"\022\012\021\001\002\000\016\005\ufff9\006\ufff9\007\ufff9" +
"\010\ufff9\011\022\012\021\001\002\000\020\002\ufffc\003" +
"\ufffc\004\ufffc\006\ufffc\010\ufffc\014\ufffc\015\ufffc\001\002" +
"\000\012\004\011\010\006\014\012\015\024\001\002\000" +
"\010\006\037\007\027\010\031\001\002\000\020\002\ufffd" +
"\003\ufffd\004\ufffd\006\ufffd\010\ufffd\014\ufffd\015\ufffd\001" +
"\002\000\016\005\ufff7\006\ufff7\007\ufff7\010\ufff7\011\022" +
"\012\021\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\037\000\006\003\003\004\004\001\001\000\002\001" +
"\001\000\012\005\012\006\007\007\013\010\015\001\001" +
"\000\006\007\037\010\015\001\001\000\002\001\001\000" +
"\002\001\001\000\010\006\025\007\013\010\015\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\010\024\001\001\000\004\010\022\001" +
"\001\000\002\001\001\000\002\001\001\000\002\001\001" +
"\000\002\001\001\000\006\007\032\010\015\001\001\000" +
"\002\001\001\000\006\007\031\010\015\001\001\000\002" +
"\001\001\000\002\001\001\000\002\001\001\000\010\006" +
"\035\007\013\010\015\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 17: // Factor ::= 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(6/*Factor*/, ((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: // Factor ::= 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( Integer.parseInt( value ) );
CUP$parser$result = new java_cup.runtime.Symbol(6/*Factor*/, ((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 15: // Factor ::= 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(6/*Factor*/, ((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: // Term ::= Factor
{
ExprNode RESULT = null;
int factorleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int factorright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode factor = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = factor;
CUP$parser$result = new java_cup.runtime.Symbol(5/*Term*/, ((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 13: // Term ::= Term DIVIDE Factor
{
ExprNode RESULT = null;
int termleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int termright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode term = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int factorleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int factorright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode factor = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new DivideNode( term, factor );
CUP$parser$result = new java_cup.runtime.Symbol(5/*Term*/, ((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: // Term ::= Term TIMES Factor
{
ExprNode RESULT = null;
int termleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left;
int termright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right;
ExprNode term = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value;
int factorleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int factorright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode factor = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new TimesNode( term, factor );
CUP$parser$result = new java_cup.runtime.Symbol(5/*Term*/, ((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 11: // Expr ::= Term
{
ExprNode RESULT = null;
int termleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int termright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode term = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = term;
CUP$parser$result = new java_cup.runtime.Symbol(4/*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 10: // Expr ::= MINUS Term
{
ExprNode RESULT = null;
int termleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int termright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode term = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new NegateNode( term );
CUP$parser$result = new java_cup.runtime.Symbol(4/*Expr*/, ((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 9: // Expr ::= Expr MINUS Term
{
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 termleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int termright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode term = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new MinusNode( expr, term );
CUP$parser$result = new java_cup.runtime.Symbol(4/*Expr*/, ((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 ::= Expr PLUS Term
{
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 termleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left;
int termright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right;
ExprNode term = (ExprNode)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value;
RESULT = new PlusNode( expr, term );
CUP$parser$result = new java_cup.runtime.Symbol(4/*Expr*/, ((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 7: // Stmt ::= NEWLINE
{
StmtNode RESULT = null;
RESULT = new NullStmtNode();
CUP$parser$result = new java_cup.runtime.Symbol(3/*Stmt*/, ((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 6: // Stmt ::= error NEWLINE
{
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 5: // Stmt ::= Expr NEWLINE
{
StmtNode 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 = new PrintStmtNode( expr );
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 4: // Stmt ::= IDENT ASSIGN Expr NEWLINE
{
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");
}
}
}