//---------------------------------------------------- // The following code was generated by CUP v0.10k // Wed May 03 15:45:42 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 = 57; public static final int CHAR = 44; public static final int GE = 24; public static final int INTVALUE = 55; public static final int INT = 43; public static final int PRINTLN = 3; public static final int FOR = 37; public static final int MINUS = 14; public static final int STATIC = 49; public static final int NOT = 20; public static final int SEMICOLON = 10; public static final int AND = 19; public static final int LT = 21; public static final int RIGHTSQ = 31; public static final int OR = 18; public static final int BOOL = 45; public static final int COMMA = 11; public static final int CLASS = 48; public static final int INC = 27; public static final int DOTDOT = 12; public static final int BEGIN = 32; public static final int LEFTSQ = 30; public static final int PLUS = 13; public static final int ASSIGN = 17; public static final int IF = 4; public static final int THIS = 41; public static final int DOT = 39; public static final int LE = 23; public static final int LEFT = 8; public static final int EOF = 0; public static final int RETURN = 38; public static final int SIZE = 40; public static final int RIGHTCURLY = 54; public static final int NEW = 29; public static final int error = 1; public static final int CHARVALUE = 56; public static final int NULL = 42; public static final int REALVALUE = 58; public static final int MOD = 51; public static final int IDENT = 59; public static final int VOID = 47; public static final int EQ = 25; public static final int LEFTCURLY = 53; public static final int REAL = 46; public static final int TIMES = 15; public static final int ELSE = 6; public static final int WHILE = 35; public static final int INSTANCE = 50; public static final int THEN = 5; public static final int EXTENDS = 52; public static final int NE = 26; public static final int END = 33; public static final int DEC = 28; public static final int RIGHT = 9; public static final int GT = 22; public static final int VAR = 34; public static final int ELIF = 7; public static final int DO = 36; public static final int PRINT = 2; static final int ClassBodyDeclStmt = 9; static final int RelExpr = 23; static final int ExprListOpt = 14; static final int FormalParamDeclList = 7; static final int Stmt = 12; static final int OrExpr = 21; static final int GlobalDeclStmt = 8; static final int StaticOpt = 33; static final int Primary = 28; static final int InstanceOpt = 34; static final int GlobalDeclStmtList = 3; static final int Expr = 19; static final int ExprList = 15; static final int AssignExpr = 20; static final int MulExpr = 25; static final int $START = 0; static final int FormalParamList = 16; static final int Type = 2; static final int LocalDeclStmtList = 5; static final int PostfixExpr = 27; static final int ExtendsOpt = 32; static final int LocalVar = 18; static final int AddExpr = 24; static final int LocalDeclStmt = 11; static final int ElseOpt = 13; static final int PrefixExpr = 26; static final int FormalParamDecl = 10; static final int Variable = 31; static final int LiteralValue = 29; static final int LocalVarList = 17; static final int MethodName = 30; static final int AndExpr = 22; static final int ClassBodyDeclStmtList = 4; static final int Program = 1; static final int StmtList = 6; public static String terminal_name( int id ) { switch ( id ) { case 16: return "DIVIDE"; case 57: return "STRINGVALUE"; case 44: return "CHAR"; case 24: return "GE"; case 55: return "INTVALUE"; case 43: return "INT"; case 3: return "PRINTLN"; case 37: return "FOR"; case 14: return "MINUS"; case 49: return "STATIC"; case 20: return "NOT"; case 10: return "SEMICOLON"; case 19: return "AND"; case 21: return "LT"; case 31: return "RIGHTSQ"; case 18: return "OR"; case 45: return "BOOL"; case 11: return "COMMA"; case 48: return "CLASS"; case 27: return "INC"; case 12: return "DOTDOT"; case 32: return "BEGIN"; case 30: return "LEFTSQ"; case 13: return "PLUS"; case 17: return "ASSIGN"; case 4: return "IF"; case 41: return "THIS"; case 39: return "DOT"; case 23: return "LE"; case 8: return "LEFT"; case 0: return "EOF"; case 38: return "RETURN"; case 40: return "SIZE"; case 54: return "RIGHTCURLY"; case 29: return "NEW"; case 1: return "error"; case 56: return "CHARVALUE"; case 42: return "NULL"; case 58: return "REALVALUE"; case 51: return "MOD"; case 59: return "IDENT"; case 47: return "VOID"; case 25: return "EQ"; case 53: return "LEFTCURLY"; case 46: return "REAL"; case 15: return "TIMES"; case 6: return "ELSE"; case 35: return "WHILE"; case 50: return "INSTANCE"; case 5: return "THEN"; case 52: return "EXTENDS"; case 26: return "NE"; case 33: return "END"; case 28: return "DEC"; case 9: return "RIGHT"; case 22: return "GT"; case 34: return "VAR"; case 7: return "ELIF"; case 36: return "DO"; case 2: return "PRINT"; default: return "unknown terminal" + id; } } public static String non_terminal_name( int id ) { switch ( id ) { case 9: return "ClassBodyDeclStmt"; case 23: return "RelExpr"; case 14: return "ExprListOpt"; case 7: return "FormalParamDeclList"; case 12: return "Stmt"; case 21: return "OrExpr"; case 8: return "GlobalDeclStmt"; case 33: return "StaticOpt"; case 28: return "Primary"; case 34: return "InstanceOpt"; case 3: return "GlobalDeclStmtList"; case 19: return "Expr"; case 15: return "ExprList"; case 20: return "AssignExpr"; case 25: return "MulExpr"; case 0: return "$START"; case 16: return "FormalParamList"; case 2: return "Type"; case 5: return "LocalDeclStmtList"; case 27: return "PostfixExpr"; case 32: return "ExtendsOpt"; case 18: return "LocalVar"; case 24: return "AddExpr"; case 11: return "LocalDeclStmt"; case 13: return "ElseOpt"; case 26: return "PrefixExpr"; case 10: return "FormalParamDecl"; case 31: return "Variable"; case 29: return "LiteralValue"; case 17: return "LocalVarList"; case 30: return "MethodName"; case 22: return "AndExpr"; case 4: return "ClassBodyDeclStmtList"; case 1: return "Program"; case 6: return "StmtList"; default: return "unknown non_terminal" + id; } } public static String rule_name( int id ) { switch ( id ) { case 108: return "Variable ::= Primary DOT IDENT "; case 107: return "Variable ::= Primary LEFTSQ Expr RIGHTSQ "; case 106: return "Variable ::= IDENT "; case 105: return "LiteralValue ::= STRINGVALUE "; case 104: return "LiteralValue ::= CHARVALUE "; case 103: return "LiteralValue ::= NULL "; case 102: return "LiteralValue ::= THIS "; case 101: return "LiteralValue ::= REALVALUE "; case 100: return "LiteralValue ::= INTVALUE "; case 99: return "MethodName ::= Primary DOT IDENT "; case 98: return "MethodName ::= IDENT "; case 97: return "Primary ::= NEW LEFTSQ RIGHTSQ Type LEFTCURLY ExprList RIGHTCURLY "; case 96: return "Primary ::= NEW LEFTSQ Expr RIGHTSQ Type "; case 95: return "Primary ::= NEW IDENT "; case 94: return "Primary ::= MethodName LEFT ExprListOpt RIGHT "; case 93: return "Primary ::= Primary LEFTSQ Expr DOTDOT Expr RIGHTSQ "; case 92: return "Primary ::= Variable "; case 91: return "Primary ::= LiteralValue "; case 90: return "Primary ::= LEFT Expr RIGHT "; case 89: return "PostfixExpr ::= Primary "; case 88: return "PostfixExpr ::= Variable DEC "; case 87: return "PostfixExpr ::= Variable INC "; case 86: return "PrefixExpr ::= PostfixExpr "; case 85: return "PrefixExpr ::= DEC Variable "; case 84: return "PrefixExpr ::= INC Variable "; case 83: return "PrefixExpr ::= SIZE PrefixExpr "; case 82: return "PrefixExpr ::= NOT PrefixExpr "; case 81: return "PrefixExpr ::= MINUS PrefixExpr "; case 80: return "MulExpr ::= PrefixExpr "; case 79: return "MulExpr ::= MulExpr MOD PrefixExpr "; case 78: return "MulExpr ::= MulExpr DIVIDE PrefixExpr "; case 77: return "MulExpr ::= MulExpr TIMES PrefixExpr "; case 76: return "AddExpr ::= MulExpr "; case 75: return "AddExpr ::= AddExpr MINUS MulExpr "; case 74: return "AddExpr ::= AddExpr PLUS MulExpr "; case 73: return "RelExpr ::= AddExpr "; case 72: return "RelExpr ::= AddExpr NE AddExpr "; case 71: return "RelExpr ::= AddExpr EQ AddExpr "; case 70: return "RelExpr ::= AddExpr GE AddExpr "; case 69: return "RelExpr ::= AddExpr LE AddExpr "; case 68: return "RelExpr ::= AddExpr GT AddExpr "; case 67: return "RelExpr ::= AddExpr LT AddExpr "; case 66: return "AndExpr ::= RelExpr "; case 65: return "AndExpr ::= AndExpr AND RelExpr "; case 64: return "OrExpr ::= AndExpr "; case 63: return "OrExpr ::= OrExpr OR AndExpr "; case 62: return "AssignExpr ::= OrExpr "; case 61: return "AssignExpr ::= Variable ASSIGN OrExpr "; case 60: return "Expr ::= AssignExpr "; case 59: return "ExprList ::= Expr "; case 58: return "ExprList ::= ExprList COMMA Expr "; case 57: return "ExprListOpt ::= "; case 56: return "ExprListOpt ::= ExprList "; case 55: return "ElseOpt ::= ELIF Expr THEN StmtList ElseOpt "; case 54: return "ElseOpt ::= ELSE StmtList "; case 53: return "ElseOpt ::= "; case 52: return "Stmt ::= error END "; case 51: return "Stmt ::= error SEMICOLON "; case 50: return "Stmt ::= RETURN Expr SEMICOLON "; case 49: return "Stmt ::= RETURN SEMICOLON "; case 48: return "Stmt ::= FOR Expr SEMICOLON Expr SEMICOLON Expr DO StmtList END "; case 47: return "Stmt ::= DO StmtList END WHILE Expr SEMICOLON "; case 46: return "Stmt ::= WHILE Expr DO StmtList END "; case 45: return "Stmt ::= IF Expr THEN StmtList ElseOpt END "; case 44: return "Stmt ::= PRINTLN LEFT Expr RIGHT SEMICOLON "; case 43: return "Stmt ::= PRINTLN LEFT RIGHT SEMICOLON "; case 42: return "Stmt ::= PRINT LEFT Expr RIGHT SEMICOLON "; case 41: return "Stmt ::= Expr SEMICOLON "; case 40: return "Stmt ::= SEMICOLON "; case 39: return "StmtList ::= "; case 38: return "StmtList ::= StmtList Stmt "; case 37: return "LocalVar ::= IDENT ASSIGN Expr "; case 36: return "LocalVar ::= IDENT "; case 35: return "LocalVarList ::= LocalVar "; case 34: return "LocalVarList ::= LocalVarList COMMA LocalVar "; case 33: return "LocalDeclStmt ::= Stmt "; case 32: return "LocalDeclStmt ::= Type LocalVarList SEMICOLON "; case 31: return "LocalDeclStmtList ::= "; case 30: return "LocalDeclStmtList ::= LocalDeclStmtList LocalDeclStmt "; case 29: return "Type ::= LEFTSQ RIGHTSQ Type "; case 28: return "Type ::= IDENT "; case 27: return "Type ::= REAL "; case 26: return "Type ::= BOOL "; case 25: return "Type ::= CHAR "; case 24: return "Type ::= INT "; case 23: return "FormalParamList ::= IDENT "; case 22: return "FormalParamList ::= FormalParamList COMMA IDENT "; case 21: return "FormalParamDecl ::= error SEMICOLON "; case 20: return "FormalParamDecl ::= VAR Type FormalParamList SEMICOLON "; case 19: return "FormalParamDecl ::= Type FormalParamList SEMICOLON "; case 18: return "FormalParamDeclList ::= "; case 17: return "FormalParamDeclList ::= FormalParamDeclList FormalParamDecl "; case 16: return "ClassBodyDeclStmt ::= LocalDeclStmt "; case 15: return "ClassBodyDeclStmt ::= VOID IDENT LEFT FormalParamDeclList RIGHT BEGIN LocalDeclStmtList END "; case 14: return "ClassBodyDeclStmt ::= Type IDENT LEFT FormalParamDeclList RIGHT BEGIN LocalDeclStmtList END "; case 13: return "ClassBodyDeclStmtList ::= "; case 12: return "ClassBodyDeclStmtList ::= ClassBodyDeclStmtList ClassBodyDeclStmt "; case 11: return "ExtendsOpt ::= "; case 10: return "ExtendsOpt ::= EXTENDS IDENT "; case 9: return "InstanceOpt ::= "; case 8: return "InstanceOpt ::= INSTANCE ClassBodyDeclStmtList "; case 7: return "StaticOpt ::= "; case 6: return "StaticOpt ::= STATIC ClassBodyDeclStmtList "; case 5: return "GlobalDeclStmt ::= ClassBodyDeclStmt "; case 4: return "GlobalDeclStmt ::= CLASS IDENT ExtendsOpt BEGIN StaticOpt InstanceOpt END "; case 3: return "GlobalDeclStmtList ::= "; case 2: return "GlobalDeclStmtList ::= GlobalDeclStmtList GlobalDeclStmt "; case 1: return "Program ::= GlobalDeclStmtList "; case 0: return "$START ::= Program EOF "; default: return "unknown rule" + id; } } }