//---------------------------------------------------- // The following code was generated by CUP v0.10k // Tue May 01 09:07:24 NZST 2007 //---------------------------------------------------- package grammar; /** CUP generated class containing symbol constants. */ public class sym { /* terminals */ public static final int DIVIDE = 13; public static final int STRINGVALUE = 49; public static final int CHAR = 40; public static final int GE = 22; public static final int INTVALUE = 47; public static final int INT = 39; public static final int FOR = 35; public static final int MINUS = 11; public static final int NOT = 18; public static final int SEMICOLON = 8; public static final int AND = 17; public static final int LT = 19; public static final int RIGHTSQ = 30; public static final int OR = 16; public static final int BOOL = 41; public static final int COMMA = 9; public static final int CLASS = 43; public static final int INC = 25; public static final int BEGIN = 31; public static final int LEFTSQ = 29; public static final int PLUS = 10; public static final int ASSIGN = 15; public static final int IF = 2; public static final int THIS = 45; public static final int AMPERSAND = 27; public static final int DOT = 37; public static final int PTR = 28; public static final int LE = 21; public static final int LEFT = 6; public static final int EOF = 0; public static final int RETURN = 36; public static final int error = 1; public static final int CHARVALUE = 48; public static final int NULL = 38; public static final int MOD = 14; public static final int IDENT = 50; public static final int VOID = 42; public static final int EQ = 23; public static final int TIMES = 12; public static final int ELSE = 4; public static final int WHILE = 33; public static final int THEN = 3; public static final int EXTENDS = 46; public static final int NE = 24; public static final int END = 32; public static final int ETC = 44; public static final int DEC = 26; public static final int RIGHT = 7; public static final int GT = 20; public static final int ELIF = 5; public static final int DO = 34; static final int MethodDecl = 17; static final int AddExpr = 35; static final int LocalVarList = 25; static final int $START = 0; static final int ClassInstanceDecl = 20; static final int GlobalDeclStmtList = 8; static final int GlobalDeclStmt = 13; static final int ClassTypeDecl = 16; static final int Variable = 42; static final int AndExpr = 33; static final int OrExpr = 32; static final int LocalVar = 26; static final int ExprListOpt = 28; static final int Primary = 39; static final int PostfixExpr = 38; static final int LiteralValue = 40; static final int PrefixExpr = 37; static final int InitVarDecl = 19; static final int FormalType = 2; static final int LocalDeclStmt = 14; static final int ActualType = 1; static final int MemberDeclList = 10; static final int MethodName = 41; static final int RelExpr = 34; static final int LocalDeclStmtList = 9; static final int IdentList = 24; static final int ExtendsOpt = 23; static final int AssignExpr = 31; static final int MemberDecl = 15; static final int StmtList = 12; static final int ExprList = 29; static final int Expr = 30; static final int MulExpr = 36; static final int ArrayType = 4; static final int PtrType = 5; static final int FormalParamDeclList = 11; static final int VarDecl = 18; static final int ArrayInstanceDecl = 21; static final int Stmt = 22; static final int MethodDeclBody = 7; static final int ClassType = 3; static final int BasicType = 6; static final int ElseOpt = 27; public static String terminal_name( int id ) { switch ( id ) { case 13: return "DIVIDE"; case 49: return "STRINGVALUE"; case 40: return "CHAR"; case 22: return "GE"; case 47: return "INTVALUE"; case 39: return "INT"; case 35: return "FOR"; case 11: return "MINUS"; case 18: return "NOT"; case 8: return "SEMICOLON"; case 17: return "AND"; case 19: return "LT"; case 30: return "RIGHTSQ"; case 16: return "OR"; case 41: return "BOOL"; case 9: return "COMMA"; case 43: return "CLASS"; case 25: return "INC"; case 31: return "BEGIN"; case 29: return "LEFTSQ"; case 10: return "PLUS"; case 15: return "ASSIGN"; case 2: return "IF"; case 45: return "THIS"; case 27: return "AMPERSAND"; case 37: return "DOT"; case 28: return "PTR"; case 21: return "LE"; case 6: return "LEFT"; case 0: return "EOF"; case 36: return "RETURN"; case 1: return "error"; case 48: return "CHARVALUE"; case 38: return "NULL"; case 14: return "MOD"; case 50: return "IDENT"; case 42: return "VOID"; case 23: return "EQ"; case 12: return "TIMES"; case 4: return "ELSE"; case 33: return "WHILE"; case 3: return "THEN"; case 46: return "EXTENDS"; case 24: return "NE"; case 32: return "END"; case 44: return "ETC"; case 26: return "DEC"; case 7: return "RIGHT"; case 20: return "GT"; case 5: return "ELIF"; case 34: return "DO"; default: return "unknown terminal" + id; } } public static String non_terminal_name( int id ) { switch ( id ) { case 17: return "MethodDecl"; case 35: return "AddExpr"; case 25: return "LocalVarList"; case 0: return "$START"; case 20: return "ClassInstanceDecl"; case 8: return "GlobalDeclStmtList"; case 13: return "GlobalDeclStmt"; case 16: return "ClassTypeDecl"; case 42: return "Variable"; case 33: return "AndExpr"; case 32: return "OrExpr"; case 26: return "LocalVar"; case 28: return "ExprListOpt"; case 39: return "Primary"; case 38: return "PostfixExpr"; case 40: return "LiteralValue"; case 37: return "PrefixExpr"; case 19: return "InitVarDecl"; case 2: return "FormalType"; case 14: return "LocalDeclStmt"; case 1: return "ActualType"; case 10: return "MemberDeclList"; case 41: return "MethodName"; case 34: return "RelExpr"; case 9: return "LocalDeclStmtList"; case 24: return "IdentList"; case 23: return "ExtendsOpt"; case 31: return "AssignExpr"; case 15: return "MemberDecl"; case 12: return "StmtList"; case 29: return "ExprList"; case 30: return "Expr"; case 36: return "MulExpr"; case 4: return "ArrayType"; case 5: return "PtrType"; case 11: return "FormalParamDeclList"; case 18: return "VarDecl"; case 21: return "ArrayInstanceDecl"; case 22: return "Stmt"; case 7: return "MethodDeclBody"; case 3: return "ClassType"; case 6: return "BasicType"; case 27: return "ElseOpt"; default: return "unknown non_terminal" + id; } } public static String rule_name( int id ) { switch ( id ) { case 112: return "Variable ::= Primary PTR "; case 111: return "Variable ::= Primary DOT IDENT "; case 110: return "Variable ::= Primary LEFTSQ Expr RIGHTSQ "; case 109: return "Variable ::= IDENT "; case 108: return "LiteralValue ::= NULL "; case 107: return "LiteralValue ::= STRINGVALUE "; case 106: return "LiteralValue ::= CHARVALUE "; case 105: return "LiteralValue ::= INTVALUE "; case 104: return "MethodName ::= Primary DOT IDENT "; case 103: return "MethodName ::= IDENT "; case 102: return "Primary ::= MethodName LEFT ExprListOpt RIGHT "; case 101: return "Primary ::= Variable "; case 100: return "Primary ::= THIS "; case 99: return "Primary ::= LiteralValue "; case 98: return "Primary ::= LEFT Expr RIGHT "; case 97: return "PostfixExpr ::= Primary "; case 96: return "PostfixExpr ::= Variable DEC "; case 95: return "PostfixExpr ::= Variable INC "; case 94: return "PrefixExpr ::= PostfixExpr "; case 93: return "PrefixExpr ::= AMPERSAND Variable "; case 92: return "PrefixExpr ::= DEC Variable "; case 91: return "PrefixExpr ::= INC Variable "; case 90: return "PrefixExpr ::= LEFT FormalType RIGHT PrefixExpr "; case 89: return "PrefixExpr ::= NOT PrefixExpr "; case 88: return "PrefixExpr ::= MINUS PrefixExpr "; case 87: return "MulExpr ::= PrefixExpr "; case 86: return "MulExpr ::= MulExpr MOD PrefixExpr "; case 85: return "MulExpr ::= MulExpr DIVIDE PrefixExpr "; case 84: return "MulExpr ::= MulExpr TIMES PrefixExpr "; case 83: return "AddExpr ::= MulExpr "; case 82: return "AddExpr ::= AddExpr MINUS MulExpr "; case 81: return "AddExpr ::= AddExpr PLUS MulExpr "; case 80: return "RelExpr ::= AddExpr "; case 79: return "RelExpr ::= AddExpr NE AddExpr "; case 78: return "RelExpr ::= AddExpr EQ AddExpr "; case 77: return "RelExpr ::= AddExpr GE AddExpr "; case 76: return "RelExpr ::= AddExpr LE AddExpr "; case 75: return "RelExpr ::= AddExpr GT AddExpr "; case 74: return "RelExpr ::= AddExpr LT AddExpr "; case 73: return "AndExpr ::= RelExpr "; case 72: return "AndExpr ::= AndExpr AND RelExpr "; case 71: return "OrExpr ::= AndExpr "; case 70: return "OrExpr ::= OrExpr OR AndExpr "; case 69: return "AssignExpr ::= OrExpr "; case 68: return "AssignExpr ::= Variable ASSIGN OrExpr "; case 67: return "Expr ::= AssignExpr "; case 66: return "ExprList ::= Expr "; case 65: return "ExprList ::= ExprList COMMA Expr "; case 64: return "ExprListOpt ::= "; case 63: return "ExprListOpt ::= ExprList "; case 62: return "ElseOpt ::= ELIF Expr THEN StmtList ElseOpt "; case 61: return "ElseOpt ::= ELSE StmtList "; case 60: return "ElseOpt ::= "; case 59: return "Stmt ::= error SEMICOLON "; case 58: return "Stmt ::= error END "; case 57: return "Stmt ::= RETURN Expr SEMICOLON "; case 56: return "Stmt ::= RETURN SEMICOLON "; case 55: return "Stmt ::= FOR Expr SEMICOLON Expr SEMICOLON Expr DO StmtList END "; case 54: return "Stmt ::= DO StmtList END WHILE Expr SEMICOLON "; case 53: return "Stmt ::= WHILE Expr DO StmtList END "; case 52: return "Stmt ::= IF Expr THEN StmtList ElseOpt END "; case 51: return "Stmt ::= Expr SEMICOLON "; case 50: return "Stmt ::= SEMICOLON "; case 49: return "LocalVar ::= IDENT ASSIGN Expr "; case 48: return "LocalVar ::= IDENT "; case 47: return "LocalVarList ::= LocalVar "; case 46: return "LocalVarList ::= LocalVarList COMMA LocalVar "; case 45: return "IdentList ::= IDENT "; case 44: return "IdentList ::= IdentList COMMA IDENT "; case 43: return "BasicType ::= BOOL "; case 42: return "BasicType ::= CHAR "; case 41: return "BasicType ::= INT "; case 40: return "PtrType ::= PTR ActualType "; case 39: return "ArrayType ::= LEFTSQ INTVALUE RIGHTSQ ActualType "; case 38: return "ClassType ::= IDENT "; case 37: return "FormalType ::= PtrType "; case 36: return "FormalType ::= BasicType "; case 35: return "ActualType ::= ArrayType "; case 34: return "ActualType ::= ClassType "; case 33: return "ActualType ::= PtrType "; case 32: return "ActualType ::= BasicType "; case 31: return "ArrayInstanceDecl ::= ArrayType IdentList SEMICOLON "; case 30: return "ClassInstanceDecl ::= ClassType IdentList SEMICOLON "; case 29: return "InitVarDecl ::= FormalType LocalVarList SEMICOLON "; case 28: return "VarDecl ::= FormalType IdentList SEMICOLON "; case 27: return "MethodDeclBody ::= SEMICOLON "; case 26: return "MethodDeclBody ::= BEGIN LocalDeclStmtList END "; case 25: return "MethodDecl ::= VOID IDENT LEFT FormalParamDeclList RIGHT MethodDeclBody "; case 24: return "MethodDecl ::= FormalType IDENT LEFT FormalParamDeclList RIGHT MethodDeclBody "; case 23: return "ExtendsOpt ::= "; case 22: return "ExtendsOpt ::= EXTENDS IDENT "; case 21: return "ClassTypeDecl ::= CLASS IDENT ExtendsOpt BEGIN MemberDeclList END "; case 20: return "LocalDeclStmt ::= Stmt "; case 19: return "LocalDeclStmt ::= ArrayInstanceDecl "; case 18: return "LocalDeclStmt ::= ClassInstanceDecl "; case 17: return "LocalDeclStmt ::= InitVarDecl "; case 16: return "MemberDecl ::= LocalDeclStmt "; case 15: return "MemberDecl ::= MethodDecl "; case 14: return "GlobalDeclStmt ::= LocalDeclStmt "; case 13: return "GlobalDeclStmt ::= MethodDecl "; case 12: return "GlobalDeclStmt ::= ClassTypeDecl "; case 11: return "StmtList ::= "; case 10: return "StmtList ::= StmtList Stmt "; case 9: return "FormalParamDeclList ::= "; case 8: return "FormalParamDeclList ::= ETC "; case 7: return "FormalParamDeclList ::= VarDecl FormalParamDeclList "; case 6: return "LocalDeclStmtList ::= "; case 5: return "LocalDeclStmtList ::= LocalDeclStmtList LocalDeclStmt "; case 4: return "MemberDeclList ::= "; case 3: return "MemberDeclList ::= MemberDeclList MemberDecl "; case 2: return "GlobalDeclStmtList ::= "; case 1: return "GlobalDeclStmtList ::= GlobalDeclStmtList GlobalDeclStmt "; case 0: return "$START ::= GlobalDeclStmtList EOF "; default: return "unknown rule" + id; } } }