//---------------------------------------------------- // The following code was generated by CUP v0.10k // Tue Mar 27 11:18:03 NZST 2007 //---------------------------------------------------- package grammar; /** CUP generated class containing symbol constants. */ public class sym { /* terminals */ public static final int DIVIDE = 15; public static final int STRINGVALUE = 33; public static final int GE = 9; public static final int INTVALUE = 34; public static final int LEXERROR = 2; public static final int FOR = 23; public static final int MINUS = 13; public static final int NOT = 5; public static final int SEMICOLON = 25; public static final int AND = 4; public static final int LT = 6; public static final int OR = 3; public static final int COMMA = 30; public static final int PLUS = 12; public static final int ASSIGN = 16; public static final int IF = 18; public static final int LE = 7; public static final int LEFT = 28; public static final int EOF = 0; public static final int TRUE = 31; public static final int RIGHTCURLY = 27; public static final int error = 1; public static final int IDENT = 35; public static final int EQ = 10; public static final int LEFTCURLY = 26; public static final int TIMES = 14; public static final int ELSE = 20; public static final int TO = 24; public static final int WHILE = 21; public static final int THEN = 19; public static final int NE = 11; public static final int FALSE = 32; public static final int RIGHT = 29; public static final int GT = 8; public static final int PRINT = 17; public static final int DO = 22; static final int Program = 1; static final int Expr = 5; static final int ExprList = 4; static final int StmtList = 2; static final int RelExpr = 9; static final int PlusExpr = 10; static final int NotExpr = 8; static final int MulExpr = 11; static final int AndExpr = 7; static final int OrExpr = 6; static final int Stmt = 3; static final int $START = 0; static final int Primary = 12; public static String terminal_name( int id ) { switch ( id ) { case 15: return "DIVIDE"; case 33: return "STRINGVALUE"; case 9: return "GE"; case 34: return "INTVALUE"; case 2: return "LEXERROR"; case 23: return "FOR"; case 13: return "MINUS"; case 5: return "NOT"; case 25: return "SEMICOLON"; case 4: return "AND"; case 6: return "LT"; case 3: return "OR"; case 30: return "COMMA"; case 12: return "PLUS"; case 16: return "ASSIGN"; case 18: return "IF"; case 7: return "LE"; case 28: return "LEFT"; case 0: return "EOF"; case 31: return "TRUE"; case 27: return "RIGHTCURLY"; case 1: return "error"; case 35: return "IDENT"; case 10: return "EQ"; case 26: return "LEFTCURLY"; case 14: return "TIMES"; case 20: return "ELSE"; case 24: return "TO"; case 21: return "WHILE"; case 19: return "THEN"; case 11: return "NE"; case 32: return "FALSE"; case 29: return "RIGHT"; case 8: return "GT"; case 17: return "PRINT"; case 22: return "DO"; default: return "unknown terminal" + id; } } public static String non_terminal_name( int id ) { switch ( id ) { case 1: return "Program"; case 5: return "Expr"; case 4: return "ExprList"; case 2: return "StmtList"; case 9: return "RelExpr"; case 10: return "PlusExpr"; case 8: return "NotExpr"; case 11: return "MulExpr"; case 7: return "AndExpr"; case 6: return "OrExpr"; case 3: return "Stmt"; case 0: return "$START"; case 12: return "Primary"; default: return "unknown non_terminal" + id; } } public static String rule_name( int id ) { switch ( id ) { case 41: return "Primary ::= IDENT "; case 40: return "Primary ::= STRINGVALUE "; case 39: return "Primary ::= INTVALUE "; case 38: return "Primary ::= FALSE "; case 37: return "Primary ::= TRUE "; case 36: return "Primary ::= LEFT Expr RIGHT "; case 35: return "MulExpr ::= Primary "; case 34: return "MulExpr ::= MulExpr DIVIDE Primary "; case 33: return "MulExpr ::= MulExpr TIMES Primary "; case 32: return "PlusExpr ::= MulExpr "; case 31: return "PlusExpr ::= MINUS MulExpr "; case 30: return "PlusExpr ::= PlusExpr MINUS MulExpr "; case 29: return "PlusExpr ::= PlusExpr PLUS MulExpr "; case 28: return "RelExpr ::= PlusExpr "; case 27: return "RelExpr ::= PlusExpr NE PlusExpr "; case 26: return "RelExpr ::= PlusExpr EQ PlusExpr "; case 25: return "RelExpr ::= PlusExpr GE PlusExpr "; case 24: return "RelExpr ::= PlusExpr GT PlusExpr "; case 23: return "RelExpr ::= PlusExpr LE PlusExpr "; case 22: return "RelExpr ::= PlusExpr LT PlusExpr "; case 21: return "NotExpr ::= RelExpr "; case 20: return "NotExpr ::= NOT NotExpr "; case 19: return "AndExpr ::= NotExpr "; case 18: return "AndExpr ::= AndExpr AND NotExpr "; case 17: return "OrExpr ::= AndExpr "; case 16: return "OrExpr ::= OrExpr OR AndExpr "; case 15: return "Expr ::= OrExpr "; case 14: return "ExprList ::= ExprList COMMA Expr "; case 13: return "ExprList ::= Expr "; case 12: return "Stmt ::= error RIGHTCURLY "; case 11: return "Stmt ::= error SEMICOLON "; case 10: return "Stmt ::= LEFTCURLY StmtList RIGHTCURLY "; case 9: return "Stmt ::= FOR IDENT ASSIGN Expr TO Expr DO Stmt "; case 8: return "Stmt ::= WHILE Expr DO Stmt "; case 7: return "Stmt ::= IF Expr THEN Stmt "; case 6: return "Stmt ::= IF Expr THEN Stmt ELSE Stmt "; case 5: return "Stmt ::= PRINT LEFT ExprList RIGHT SEMICOLON "; case 4: return "Stmt ::= IDENT ASSIGN Expr SEMICOLON "; case 3: return "StmtList ::= StmtList Stmt "; case 2: return "StmtList ::= "; case 1: return "Program ::= StmtList "; case 0: return "$START ::= Program EOF "; default: return "unknown rule" + id; } } }