//---------------------------------------------------- // The following code was generated by CUP v0.10k // Wed May 03 15:15:00 NZST 2006 //---------------------------------------------------- package grammar; /** CUP generated class containing symbol constants. */ public class sym { /* terminals */ public static final int TIMES = 6; public static final int LT = 10; public static final int NE = 15; public static final int IDENT = 24; public static final int ELSE = 18; public static final int SEMICOLON = 9; public static final int PLUS = 4; public static final int THEN = 17; public static final int WHILE = 19; public static final int IF = 16; public static final int GT = 12; public static final int LE = 11; public static final int DO = 20; public static final int RIGHT = 3; public static final int LEFT = 2; public static final int NUMBER = 23; public static final int EOF = 0; public static final int DIVIDE = 7; public static final int GE = 13; public static final int MINUS = 5; public static final int error = 1; public static final int ASSIGN = 8; public static final int EQ = 14; public static final int RIGHTCURLY = 22; public static final int LEFTCURLY = 21; static final int Program = 1; static final int Factor = 7; static final int Term = 6; static final int Stmt = 3; static final int Expr = 5; static final int BoolExpr = 4; static final int $START = 0; static final int StmtList = 2; public static String terminal_name( int id ) { switch ( id ) { case 6: return "TIMES"; case 10: return "LT"; case 15: return "NE"; case 24: return "IDENT"; case 18: return "ELSE"; case 9: return "SEMICOLON"; case 4: return "PLUS"; case 17: return "THEN"; case 19: return "WHILE"; case 16: return "IF"; case 12: return "GT"; case 11: return "LE"; case 20: return "DO"; case 3: return "RIGHT"; case 2: return "LEFT"; case 23: return "NUMBER"; case 0: return "EOF"; case 7: return "DIVIDE"; case 13: return "GE"; case 5: return "MINUS"; case 1: return "error"; case 8: return "ASSIGN"; case 14: return "EQ"; case 22: return "RIGHTCURLY"; case 21: return "LEFTCURLY"; default: return "unknown terminal" + id; } } public static String non_terminal_name( int id ) { switch ( id ) { case 1: return "Program"; case 7: return "Factor"; case 6: return "Term"; case 3: return "Stmt"; case 5: return "Expr"; case 4: return "BoolExpr"; case 0: return "$START"; case 2: return "StmtList"; default: return "unknown non_terminal" + id; } } public static String rule_name( int id ) { switch ( id ) { case 26: return "Factor ::= IDENT "; case 25: return "Factor ::= NUMBER "; case 24: return "Factor ::= LEFT Expr RIGHT "; case 23: return "Term ::= Factor "; case 22: return "Term ::= Term DIVIDE Factor "; case 21: return "Term ::= Term TIMES Factor "; case 20: return "Expr ::= Term "; case 19: return "Expr ::= MINUS Term "; case 18: return "Expr ::= Expr MINUS Term "; case 17: return "Expr ::= Expr PLUS Term "; case 16: return "BoolExpr ::= Expr NE Expr "; case 15: return "BoolExpr ::= Expr EQ Expr "; case 14: return "BoolExpr ::= Expr GE Expr "; case 13: return "BoolExpr ::= Expr GT Expr "; case 12: return "BoolExpr ::= Expr LE Expr "; case 11: return "BoolExpr ::= Expr LT Expr "; case 10: return "Stmt ::= error RIGHTCURLY "; case 9: return "Stmt ::= error SEMICOLON "; case 8: return "Stmt ::= LEFTCURLY StmtList RIGHTCURLY "; case 7: return "Stmt ::= WHILE BoolExpr DO Stmt "; case 6: return "Stmt ::= IF BoolExpr THEN Stmt "; case 5: return "Stmt ::= IF BoolExpr THEN Stmt ELSE Stmt "; 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; } } }