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