//---------------------------------------------------- // The following code was generated by CUP v0.10k // Wed May 03 15:15:15 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 = 56; public static final int CHAR = 47; public static final int GE = 24; public static final int INTVALUE = 54; public static final int INT = 46; public static final int PRINTLN = 3; public static final int FOR = 36; public static final int MINUS = 14; 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 = 30; public static final int TYPE = 51; public static final int OR = 18; public static final int BOOL = 48; 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 = 4; public static final int DOT = 40; public static final int LE = 23; public static final int LEFT = 8; public static final int EOF = 0; public static final int RETURN = 39; public static final int SIZE = 41; public static final int PROGRAM = 45; public static final int RIGHTCURLY = 38; public static final int NEW = 28; public static final int error = 1; public static final int CHARVALUE = 55; public static final int NULL = 42; public static final int REALVALUE = 57; public static final int IDENT = 58; public static final int VOID = 53; public static final int EQ = 25; public static final int LEFTCURLY = 37; public static final int REAL = 50; public static final int TIMES = 15; public static final int COLON = 11; public static final int ELSE = 6; public static final int WHILE = 34; public static final int THEN = 5; public static final int NE = 26; public static final int END = 32; public static final int STRING = 49; public static final int CHR = 44; public static final int STRUCT = 52; public static final int RIGHT = 9; public static final int GT = 22; public static final int FUNCT = 27; public static final int VAR = 33; public static final int ELIF = 7; public static final int DO = 35; public static final int PRINT = 2; static final int RelExpr = 22; static final int ExprListOpt = 15; static final int FormalParamDeclList = 8; static final int Stmt = 14; static final int StructType = 5; static final int OrExpr = 20; static final int Primary = 26; static final int ReturnType = 28; static final int Expr = 18; static final int ExprList = 16; static final int AssignExpr = 19; static final int MulExpr = 24; static final int $START = 0; static final int FieldDecl = 10; static final int Type = 3; static final int LocalDecl = 9; static final int LocalDeclList = 6; static final int AddExpr = 23; static final int ElseOpt = 13; static final int Block = 2; static final int PrefixExpr = 25; static final int IdentList = 17; static final int FormalParamDecl = 11; static final int Variable = 27; static final int ArrayType = 4; static final int AndExpr = 21; static final int Program = 1; static final int FieldDeclList = 7; static final int StmtList = 12; public static String terminal_name( int id ) { switch ( id ) { case 16: return "DIVIDE"; case 56: return "STRINGVALUE"; case 47: return "CHAR"; case 24: return "GE"; case 54: return "INTVALUE"; case 46: return "INT"; case 3: return "PRINTLN"; case 36: return "FOR"; case 14: return "MINUS"; case 20: return "NOT"; case 10: return "SEMICOLON"; case 19: return "AND"; case 21: return "LT"; case 30: return "RIGHTSQ"; case 51: return "TYPE"; case 18: return "OR"; case 48: return "BOOL"; 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 4: return "IF"; case 40: return "DOT"; case 23: return "LE"; case 8: return "LEFT"; case 0: return "EOF"; case 39: return "RETURN"; case 41: return "SIZE"; case 45: return "PROGRAM"; case 38: return "RIGHTCURLY"; case 28: return "NEW"; case 1: return "error"; case 55: return "CHARVALUE"; case 42: return "NULL"; case 57: return "REALVALUE"; case 58: return "IDENT"; case 53: return "VOID"; case 25: return "EQ"; case 37: return "LEFTCURLY"; case 50: return "REAL"; case 15: return "TIMES"; case 11: return "COLON"; case 6: return "ELSE"; case 34: return "WHILE"; case 5: return "THEN"; case 26: return "NE"; case 32: return "END"; case 49: return "STRING"; case 44: return "CHR"; case 52: return "STRUCT"; case 9: return "RIGHT"; case 22: return "GT"; case 27: return "FUNCT"; case 33: return "VAR"; case 7: return "ELIF"; case 35: return "DO"; case 2: return "PRINT"; default: return "unknown terminal" + id; } } public static String non_terminal_name( int id ) { switch ( id ) { case 22: return "RelExpr"; case 15: return "ExprListOpt"; case 8: return "FormalParamDeclList"; case 14: return "Stmt"; case 5: return "StructType"; case 20: return "OrExpr"; case 26: return "Primary"; case 28: return "ReturnType"; case 18: return "Expr"; case 16: return "ExprList"; case 19: return "AssignExpr"; case 24: return "MulExpr"; case 0: return "$START"; case 10: return "FieldDecl"; case 3: return "Type"; case 9: return "LocalDecl"; case 6: return "LocalDeclList"; case 23: return "AddExpr"; case 13: return "ElseOpt"; case 2: return "Block"; case 25: return "PrefixExpr"; case 17: return "IdentList"; case 11: return "FormalParamDecl"; case 27: return "Variable"; case 4: return "ArrayType"; case 21: return "AndExpr"; case 1: return "Program"; case 7: return "FieldDeclList"; case 12: return "StmtList"; default: return "unknown non_terminal" + id; } } public static String rule_name( int id ) { switch ( id ) { case 93: return "ExprList ::= Expr "; case 92: return "ExprList ::= ExprList COMMA Expr "; case 91: return "ExprListOpt ::= "; case 90: return "ExprListOpt ::= ExprList "; case 89: return "IdentList ::= IDENT "; case 88: return "IdentList ::= IdentList COMMA IDENT "; case 87: return "Variable ::= Primary DOT IDENT "; case 86: return "Variable ::= Primary LEFTSQ Expr RIGHTSQ "; case 85: return "Variable ::= IDENT "; case 84: return "Primary ::= CHR LEFT Expr RIGHT "; case 83: return "Primary ::= ORD LEFT Expr RIGHT "; case 82: return "Primary ::= IDENT LEFT ExprListOpt RIGHT "; case 81: return "Primary ::= Variable "; case 80: return "Primary ::= STRINGVALUE "; case 79: return "Primary ::= CHARVALUE "; case 78: return "Primary ::= NULL "; case 77: return "Primary ::= REALVALUE "; case 76: return "Primary ::= INTVALUE "; case 75: return "Primary ::= LEFT Expr RIGHT "; case 74: return "PrefixExpr ::= Primary "; case 73: return "PrefixExpr ::= NEW Type LEFTCURLY ExprListOpt RIGHTCURLY "; case 72: return "PrefixExpr ::= NEW Type "; case 71: return "PrefixExpr ::= NEW LEFTSQ Expr RIGHTSQ Type "; case 70: return "PrefixExpr ::= SIZE PrefixExpr "; case 69: return "PrefixExpr ::= NOT PrefixExpr "; case 68: return "PrefixExpr ::= MINUS PrefixExpr "; case 67: return "MulExpr ::= PrefixExpr "; case 66: return "MulExpr ::= MulExpr DIVIDE PrefixExpr "; case 65: return "MulExpr ::= MulExpr TIMES PrefixExpr "; case 64: return "AddExpr ::= MulExpr "; case 63: return "AddExpr ::= AddExpr MINUS MulExpr "; case 62: return "AddExpr ::= AddExpr PLUS MulExpr "; case 61: return "RelExpr ::= AddExpr "; case 60: return "RelExpr ::= AddExpr NE AddExpr "; case 59: return "RelExpr ::= AddExpr EQ AddExpr "; case 58: return "RelExpr ::= AddExpr GE AddExpr "; case 57: return "RelExpr ::= AddExpr LE AddExpr "; case 56: return "RelExpr ::= AddExpr GT AddExpr "; case 55: return "RelExpr ::= AddExpr LT AddExpr "; case 54: return "AndExpr ::= RelExpr "; case 53: return "AndExpr ::= AndExpr AND RelExpr "; case 52: return "OrExpr ::= AndExpr "; case 51: return "OrExpr ::= OrExpr OR AndExpr "; case 50: return "AssignExpr ::= OrExpr "; case 49: return "AssignExpr ::= Variable ASSIGN AssignExpr "; case 48: return "Expr ::= AssignExpr "; case 47: return "ElseOpt ::= ELIF Expr THEN StmtList ElseOpt "; case 46: return "ElseOpt ::= ELSE StmtList "; case 45: return "ElseOpt ::= "; case 44: return "Stmt ::= error END "; case 43: return "Stmt ::= error SEMICOLON "; case 42: return "Stmt ::= RETURN Expr SEMICOLON "; case 41: return "Stmt ::= RETURN SEMICOLON "; case 40: return "Stmt ::= FOR Expr SEMICOLON Expr SEMICOLON Expr DO StmtList END "; case 39: return "Stmt ::= DO StmtList END WHILE Expr SEMICOLON "; case 38: return "Stmt ::= WHILE Expr DO StmtList END "; case 37: return "Stmt ::= IF Expr THEN StmtList ElseOpt END "; case 36: return "Stmt ::= PRINTLN LEFT Expr RIGHT SEMICOLON "; case 35: return "Stmt ::= PRINTLN LEFT RIGHT SEMICOLON "; case 34: return "Stmt ::= PRINT LEFT Expr RIGHT SEMICOLON "; case 33: return "Stmt ::= Expr SEMICOLON "; case 32: return "Stmt ::= SEMICOLON "; case 31: return "StmtList ::= "; case 30: return "StmtList ::= StmtList Stmt "; case 29: return "StructType ::= STRUCT LEFT FieldDeclList RIGHT "; case 28: return "ArrayType ::= LEFTSQ RIGHTSQ Type "; case 27: return "Type ::= StructType "; case 26: return "Type ::= ArrayType "; case 25: return "Type ::= IDENT "; case 24: return "Type ::= REAL "; case 23: return "Type ::= STRING "; case 22: return "Type ::= BOOL "; case 21: return "Type ::= CHAR "; case 20: return "Type ::= INT "; case 19: return "ReturnType ::= VOID "; case 18: return "ReturnType ::= Type "; case 17: return "FormalParamDecl ::= error SEMICOLON "; case 16: return "FormalParamDecl ::= VAR IdentList COLON Type SEMICOLON "; case 15: return "FormalParamDecl ::= IdentList COLON Type SEMICOLON "; case 14: return "FieldDecl ::= error SEMICOLON "; case 13: return "FieldDecl ::= IdentList COLON Type SEMICOLON "; case 12: return "LocalDecl ::= error SEMICOLON "; case 11: return "LocalDecl ::= FUNCT IDENT LEFT FormalParamDeclList RIGHT ReturnType Block "; case 10: return "LocalDecl ::= VAR IdentList COLON Type SEMICOLON "; case 9: return "LocalDecl ::= TYPE IDENT ASSIGN Type SEMICOLON "; case 8: return "FormalParamDeclList ::= "; case 7: return "FormalParamDeclList ::= FormalParamDeclList FormalParamDecl "; case 6: return "FieldDeclList ::= "; case 5: return "FieldDeclList ::= FieldDeclList FieldDecl "; case 4: return "LocalDeclList ::= "; case 3: return "LocalDeclList ::= LocalDeclList LocalDecl "; case 2: return "Block ::= LocalDeclList BEGIN StmtList END "; case 1: return "Program ::= PROGRAM Block DOT "; case 0: return "$START ::= Program EOF "; default: return "unknown rule" + id; } } }