//---------------------------------------------------- // The following code was generated by CUP v0.10k // Wed May 03 15:15:09 NZST 2006 //---------------------------------------------------- package grammar; /** CUP generated class containing symbol constants. */ public class sym { /* terminals */ public static final int DIVIDE = 16; public static final int STRINGVALUE = 47; public static final int GE = 24; public static final int INTVALUE = 45; public static final int PRINTLN = 4; public static final int FOR = 36; public static final int MINUS = 14; public static final int NOT = 20; public static final int SEMICOLON = 11; public static final int AND = 19; public static final int LT = 21; public static final int RIGHTSQ = 30; public static final int OR = 18; public static final int COMMA = 12; public static final int ORD = 43; public static final int BEGIN = 31; public static final int LEFTSQ = 29; public static final int PLUS = 13; public static final int ASSIGN = 17; public static final int IF = 5; public static final int DOT = 40; public static final int LE = 23; public static final int LEFT = 9; public static final int EOF = 0; public static final int RETURN = 39; public static final int SIZE = 41; public static final int RIGHTCURLY = 38; public static final int NEW = 28; public static final int error = 1; public static final int PROGRAM = 2; public static final int CHARVALUE = 46; public static final int NULL = 42; public static final int IDENT = 48; public static final int EQ = 25; public static final int LEFTCURLY = 37; public static final int TIMES = 15; public static final int ELSE = 7; public static final int WHILE = 34; public static final int THEN = 6; public static final int NE = 26; public static final int END = 32; public static final int CHR = 44; public static final int RIGHT = 10; public static final int GT = 22; public static final int FUNCT = 27; public static final int VAR = 33; public static final int ELIF = 8; public static final int DO = 35; public static final int PRINT = 3; static final int ExprListOpt = 7; static final int RelExpr = 16; static final int Stmt = 6; static final int IdentListOpt = 9; static final int OrExpr = 14; static final int Primary = 20; static final int DeclaratorList = 11; static final int ExprList = 8; static final int Expr = 12; static final int AssignExpr = 13; static final int MulExpr = 18; static final int $START = 0; static final int Decl = 2; static final int AddExpr = 17; static final int ElseOpt = 5; static final int PrefixExpr = 19; static final int IdentList = 10; static final int Variable = 21; static final int AndExpr = 15; static final int Program = 1; static final int Declarator = 3; static final int StmtList = 4; public static String terminal_name( int id ) { switch ( id ) { case 16: return "DIVIDE"; case 47: return "STRINGVALUE"; case 24: return "GE"; case 45: return "INTVALUE"; case 4: return "PRINTLN"; case 36: return "FOR"; case 14: return "MINUS"; case 20: return "NOT"; case 11: return "SEMICOLON"; case 19: return "AND"; case 21: return "LT"; case 30: return "RIGHTSQ"; case 18: return "OR"; case 12: return "COMMA"; case 43: return "ORD"; case 31: return "BEGIN"; case 29: return "LEFTSQ"; case 13: return "PLUS"; case 17: return "ASSIGN"; case 5: return "IF"; case 40: return "DOT"; case 23: return "LE"; case 9: return "LEFT"; case 0: return "EOF"; case 39: return "RETURN"; case 41: return "SIZE"; case 38: return "RIGHTCURLY"; case 28: return "NEW"; case 1: return "error"; case 2: return "PROGRAM"; case 46: return "CHARVALUE"; case 42: return "NULL"; case 48: return "IDENT"; case 25: return "EQ"; case 37: return "LEFTCURLY"; case 15: return "TIMES"; case 7: return "ELSE"; case 34: return "WHILE"; case 6: return "THEN"; case 26: return "NE"; case 32: return "END"; case 44: return "CHR"; case 10: return "RIGHT"; case 22: return "GT"; case 27: return "FUNCT"; case 33: return "VAR"; case 8: return "ELIF"; case 35: return "DO"; case 3: return "PRINT"; default: return "unknown terminal" + id; } } public static String non_terminal_name( int id ) { switch ( id ) { case 7: return "ExprListOpt"; case 16: return "RelExpr"; case 6: return "Stmt"; case 9: return "IdentListOpt"; case 14: return "OrExpr"; case 20: return "Primary"; case 11: return "DeclaratorList"; case 8: return "ExprList"; case 12: return "Expr"; case 13: return "AssignExpr"; case 18: return "MulExpr"; case 0: return "$START"; case 2: return "Decl"; case 17: return "AddExpr"; case 5: return "ElseOpt"; case 19: return "PrefixExpr"; case 10: return "IdentList"; case 21: return "Variable"; case 15: return "AndExpr"; case 1: return "Program"; case 3: return "Declarator"; case 4: return "StmtList"; default: return "unknown non_terminal" + id; } } public static String rule_name( int id ) { switch ( id ) { case 72: return "ExprList ::= Expr "; case 71: return "ExprList ::= ExprList COMMA Expr "; case 70: return "ExprListOpt ::= "; case 69: return "ExprListOpt ::= ExprList "; case 68: return "Declarator ::= IDENT ASSIGN Expr "; case 67: return "Declarator ::= IDENT "; case 66: return "DeclaratorList ::= Declarator "; case 65: return "DeclaratorList ::= DeclaratorList COMMA Declarator "; case 64: return "IdentList ::= IDENT "; case 63: return "IdentList ::= IdentList COMMA IDENT "; case 62: return "IdentListOpt ::= "; case 61: return "IdentListOpt ::= IdentList "; case 60: return "Variable ::= Primary LEFTSQ Expr RIGHTSQ "; case 59: return "Variable ::= IDENT "; case 58: return "Primary ::= LEFTCURLY ExprListOpt RIGHTCURLY "; case 57: return "Primary ::= FUNCT LEFT IdentListOpt RIGHT Decl BEGIN StmtList END "; case 56: return "Primary ::= CHR LEFT Expr RIGHT "; case 55: return "Primary ::= ORD LEFT Expr RIGHT "; case 54: return "Primary ::= Primary LEFT ExprListOpt RIGHT "; case 53: return "Primary ::= Variable "; case 52: return "Primary ::= STRINGVALUE "; case 51: return "Primary ::= CHARVALUE "; case 50: return "Primary ::= NULL "; case 49: return "Primary ::= INTVALUE "; case 48: return "Primary ::= LEFT Expr RIGHT "; case 47: return "PrefixExpr ::= Primary "; case 46: return "PrefixExpr ::= NEW LEFTSQ Expr RIGHTSQ "; case 45: return "PrefixExpr ::= SIZE PrefixExpr "; case 44: return "PrefixExpr ::= NOT PrefixExpr "; case 43: return "PrefixExpr ::= MINUS PrefixExpr "; case 42: return "MulExpr ::= PrefixExpr "; case 41: return "MulExpr ::= MulExpr DIVIDE PrefixExpr "; case 40: return "MulExpr ::= MulExpr TIMES PrefixExpr "; case 39: return "AddExpr ::= MulExpr "; case 38: return "AddExpr ::= AddExpr MINUS MulExpr "; case 37: return "AddExpr ::= AddExpr PLUS MulExpr "; case 36: return "RelExpr ::= AddExpr "; case 35: return "RelExpr ::= AddExpr NE AddExpr "; case 34: return "RelExpr ::= AddExpr EQ AddExpr "; case 33: return "RelExpr ::= AddExpr GE AddExpr "; case 32: return "RelExpr ::= AddExpr LE AddExpr "; case 31: return "RelExpr ::= AddExpr GT AddExpr "; case 30: return "RelExpr ::= AddExpr LT AddExpr "; case 29: return "AndExpr ::= RelExpr "; case 28: return "AndExpr ::= AndExpr AND RelExpr "; case 27: return "OrExpr ::= AndExpr "; case 26: return "OrExpr ::= OrExpr OR AndExpr "; case 25: return "AssignExpr ::= OrExpr "; case 24: return "AssignExpr ::= Variable ASSIGN AssignExpr "; case 23: return "Expr ::= AssignExpr "; case 22: return "ElseOpt ::= ELIF Expr THEN StmtList ElseOpt "; case 21: return "ElseOpt ::= ELSE StmtList "; case 20: return "ElseOpt ::= "; case 19: return "Stmt ::= error END "; case 18: return "Stmt ::= error SEMICOLON "; case 17: return "Stmt ::= RETURN Expr SEMICOLON "; case 16: return "Stmt ::= RETURN SEMICOLON "; case 15: return "Stmt ::= FOR Expr SEMICOLON Expr SEMICOLON Expr DO StmtList END "; case 14: return "Stmt ::= DO StmtList END WHILE Expr SEMICOLON "; case 13: return "Stmt ::= WHILE Expr DO StmtList END "; case 12: return "Stmt ::= IF Expr THEN StmtList ElseOpt END "; case 11: return "Stmt ::= PRINTLN LEFT Expr RIGHT SEMICOLON "; case 10: return "Stmt ::= PRINTLN LEFT RIGHT SEMICOLON "; case 9: return "Stmt ::= PRINT LEFT Expr RIGHT SEMICOLON "; case 8: return "Stmt ::= Expr SEMICOLON "; case 7: return "Stmt ::= SEMICOLON "; case 6: return "StmtList ::= "; case 5: return "StmtList ::= StmtList Stmt "; case 4: return "Decl ::= "; case 3: return "Decl ::= VAR error SEMICOLON "; case 2: return "Decl ::= VAR DeclaratorList SEMICOLON "; case 1: return "Program ::= PROGRAM Decl BEGIN StmtList END DOT "; case 0: return "$START ::= Program EOF "; default: return "unknown rule" + id; } } }