📄 y.output
字号:
Terminals which are not used UMINUSGrammar 0 $accept: Program $end 1 Program: DeclList 2 DeclList: DeclList Decl 3 | Decl 4 Decl: VariableDecl 5 | ClassDecl 6 | FunctionDecl 7 VariableDecl: Variable ';' 8 Variable: Type Ident 9 Ident: T_Identifier 10 Type: T_Bool 11 | T_Int 12 | T_Double 13 | T_String 14 | Ident 15 | Type T_Dims 16 ClassDecl: T_Class Ident '{' Fieldlist '}' 17 | T_Class Ident T_Extends Ident '{' Fieldlist '}' 18 Fieldlist: Fieldlist Field 19 | /* empty */ 20 Field: VariableDecl 21 | FunctionDecl 22 FunctionDecl: Type Ident '(' Formals ')' StmtBlock 23 | T_Void Ident '(' Formals ')' StmtBlock 24 | Type Ident '(' ')' StmtBlock 25 | T_Void Ident '(' ')' StmtBlock 26 Formals: Variable 27 | Formals ',' Variable 28 StmtBlock: '{' NonEmptyVList NonEmptySList '}' 29 | '{' NonEmptyVList '}' 30 | '{' NonEmptySList '}' 31 | '{' '}' 32 NonEmptyVList: VariableDecl 33 | NonEmptyVList VariableDecl 34 NonEmptySList: Stmt 35 | NonEmptySList Stmt 36 Stmt: ';' 37 | Expr ';' 38 | StmtBlock 39 | IfStmt 40 | SwitchStmt 41 | WhileStmt 42 | ForStmt 43 | ReturnStmt 44 | BreakStmt 45 | PrintStmt 46 | TryCatchBlock 47 | ThrowStmt 48 ThrowStmt: T_Throw Expr ';' 49 TryCatchBlock: T_Try '{' StmtList '}' CatchBlockList 50 StmtList: NonEmptySList 51 | /* empty */ 52 NonEmptyCBList: CatchBlock 53 | NonEmptyCBList CatchBlock 54 CatchBlockList: NonEmptyCBList 55 | /* empty */ 56 CatchBlock: T_Catch '(' Variable ')' '{' StmtList '}' 57 PrintStmt: T_Print '(' NonEmptyActuals ')' ';' 58 BreakStmt: T_Break ';' 59 ReturnStmt: T_Return Expr ';' 60 | T_Return ';' 61 IfStmt: T_If '(' Expr ')' Stmt 62 | T_If '(' Expr ')' Stmt T_Else Stmt 63 SwitchStmt: T_Switch '(' Expr ')' SwitchBody 64 SwitchBody: '{' CaseStmtList DefaultStmt '}' 65 | '{' CaseStmtList '}' 66 | '{' DefaultStmt '}' 67 | '{' '}' 68 CaseStmtList: CaseStmt 69 | CaseStmtList CaseStmt 70 CaseStmt: T_Case IntConstant ':' Stmt 71 DefaultStmt: T_Default ':' Stmt 72 WhileStmt: T_While '(' Expr ')' Stmt 73 ForStmt: T_For '(' Expr_Em ';' Expr ';' Expr_Em ')' Stmt 74 Expr_Em: Expr 75 | /* empty */ 76 Expr: Constant 77 | Expr '+' Expr 78 | Expr '*' Expr 79 | Expr '/' Expr 80 | Expr '%' Expr 81 | Expr '>' Expr 82 | Expr '<' Expr 83 | '-' Expr 84 | Expr '-' Expr 85 | Expr T_LessEqual Expr 86 | Expr T_GreaterEqual Expr 87 | Expr T_Equal Expr 88 | Expr T_NotEqual Expr 89 | Expr T_Or Expr 90 | Expr T_And Expr 91 | '!' Expr 92 | '(' Expr ')' 93 | LValue 94 | LValue '=' Expr 95 | T_New '(' Ident ')' 96 | T_NewArray '(' Expr ',' Type ')' 97 | T_ReadLine '(' ')' 98 | T_ReadInteger '(' ')' 99 | T_This 100 | Call 101 | Expr '?' Expr ':' Expr 102 Call: Ident '(' Actuals ')' 103 | Expr '.' Ident '(' Actuals ')' 104 NonEmptyActuals: Expr 105 | NonEmptyActuals ',' Expr 106 Actuals: NonEmptyActuals 107 | /* empty */ 108 LValue: Ident 109 | Expr '.' Ident 110 | Expr '[' Expr ']' 111 IntConstant: T_IntConstant 112 Constant: IntConstant 113 | T_DoubleConstant 114 | T_BoolConstant 115 | T_StringConstant 116 | T_NullTerminals, with rules where they appear$end (0) 0'!' (33) 91'%' (37) 80'(' (40) 22 23 24 25 56 57 61 62 63 72 73 92 95 96 97 98 102 103')' (41) 22 23 24 25 56 57 61 62 63 72 73 92 95 96 97 98 102 103'*' (42) 78'+' (43) 77',' (44) 27 96 105'-' (45) 83 84'.' (46) 103 109'/' (47) 79':' (58) 70 71 101';' (59) 7 36 37 48 57 58 59 60 73'<' (60) 82'=' (61) 94'>' (62) 81'?' (63) 101'[' (91) 110']' (93) 110'{' (123) 16 17 28 29 30 31 49 56 64 65 66 67'}' (125) 16 17 28 29 30 31 49 56 64 65 66 67error (256)T_Void (258) 23 25T_Bool (259) 10T_Int (260) 11T_Double (261) 12T_String (262) 13T_Class (263) 16 17T_LessEqual (264) 85T_GreaterEqual (265) 86T_Equal (266) 87T_NotEqual (267) 88T_Dims (268) 15T_And (269) 90T_Or (270) 89T_Null (271) 116T_Extends (272) 17T_This (273) 99T_While (274) 72T_For (275) 73T_If (276) 61 62T_Else (277) 62T_Return (278) 59 60T_Break (279) 58T_New (280) 95T_NewArray (281) 96T_Print (282) 57T_ReadInteger (283) 98T_ReadLine (284) 97T_Try (285) 49T_Catch (286) 56T_Throw (287) 48T_Switch (288) 63T_Case (289) 70T_Default (290) 71T_Identifier (291) 9T_StringConstant (292) 115T_IntConstant (293) 111T_DoubleConstant (294) 113T_BoolConstant (295) 114UMINUS (296)Lower_Else (297)Nonterminals, with rules where they appear$accept (63) on left: 0Program (64) on left: 1, on right: 0DeclList (65) on left: 2 3, on right: 1 2Decl (66) on left: 4 5 6, on right: 2 3VariableDecl (67) on left: 7, on right: 4 20 32 33Variable (68) on left: 8, on right: 7 26 27 56Ident (69) on left: 9, on right: 8 14 16 17 22 23 24 25 95 102 103 108 109Type (70) on left: 10 11 12 13 14 15, on right: 8 15 22 24 96ClassDecl (71) on left: 16 17, on right: 5Fieldlist (72) on left: 18 19, on right: 16 17 18Field (73) on left: 20 21, on right: 18FunctionDecl (74) on left: 22 23 24 25, on right: 6 21Formals (75) on left: 26 27, on right: 22 23 27StmtBlock (76) on left: 28 29 30 31, on right: 22 23 24 25 38NonEmptyVList (77) on left: 32 33, on right: 28 29 33NonEmptySList (78) on left: 34 35, on right: 28 30 35 50Stmt (79) on left: 36 37 38 39 40 41 42 43 44 45 46 47, on right: 34 35 61 62 70 71 72 73ThrowStmt (80) on left: 48, on right: 47TryCatchBlock (81) on left: 49, on right: 46StmtList (82) on left: 50 51, on right: 49 56NonEmptyCBList (83) on left: 52 53, on right: 53 54CatchBlockList (84) on left: 54 55, on right: 49CatchBlock (85) on left: 56, on right: 52 53PrintStmt (86) on left: 57, on right: 45BreakStmt (87) on left: 58, on right: 44ReturnStmt (88) on left: 59 60, on right: 43IfStmt (89) on left: 61 62, on right: 39SwitchStmt (90) on left: 63, on right: 40SwitchBody (91) on left: 64 65 66 67, on right: 63CaseStmtList (92) on left: 68 69, on right: 64 65 69CaseStmt (93) on left: 70, on right: 68 69DefaultStmt (94) on left: 71, on right: 64 66WhileStmt (95) on left: 72, on right: 41ForStmt (96) on left: 73, on right: 42Expr_Em (97) on left: 74 75, on right: 73Expr (98) on left: 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101, on right: 37 48 59 61 62 63 72 73 74 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 94 96 101 103 104 105 109 110Call (99) on left: 102 103, on right: 100NonEmptyActuals (100) on left: 104 105, on right: 57 105 106Actuals (101) on left: 106 107, on right: 102 103LValue (102) on left: 108 109 110, on right: 93 94IntConstant (103) on left: 111, on right: 70 112Constant (104) on left: 112 113 114 115 116, on right: 76state 0 0 $accept: . Program $end T_Void shift, and go to state 1 T_Bool shift, and go to state 2 T_Int shift, and go to state 3 T_Double shift, and go to state 4 T_String shift, and go to state 5 T_Class shift, and go to state 6 T_Identifier shift, and go to state 7 Program go to state 8 DeclList go to state 9 Decl go to state 10 VariableDecl go to state 11 Variable go to state 12 Ident go to state 13 Type go to state 14 ClassDecl go to state 15 FunctionDecl go to state 16state 1 23 FunctionDecl: T_Void . Ident '(' Formals ')' StmtBlock 25 | T_Void . Ident '(' ')' StmtBlock T_Identifier shift, and go to state 7 Ident go to state 17state 2 10 Type: T_Bool . $default reduce using rule 10 (Type)state 3 11 Type: T_Int . $default reduce using rule 11 (Type)state 4 12 Type: T_Double . $default reduce using rule 12 (Type)state 5 13 Type: T_String . $default reduce using rule 13 (Type)state 6 16 ClassDecl: T_Class . Ident '{' Fieldlist '}' 17 | T_Class . Ident T_Extends Ident '{' Fieldlist '}' T_Identifier shift, and go to state 7 Ident go to state 18state 7 9 Ident: T_Identifier . $default reduce using rule 9 (Ident)state 8 0 $accept: Program . $end $end shift, and go to state 19state 9 1 Program: DeclList . 2 DeclList: DeclList . Decl T_Void shift, and go to state 1 T_Bool shift, and go to state 2 T_Int shift, and go to state 3 T_Double shift, and go to state 4 T_String shift, and go to state 5 T_Class shift, and go to state 6 T_Identifier shift, and go to state 7 $default reduce using rule 1 (Program) Decl go to state 20 VariableDecl go to state 11 Variable go to state 12 Ident go to state 13 Type go to state 14 ClassDecl go to state 15 FunctionDecl go to state 16state 10 3 DeclList: Decl . $default reduce using rule 3 (DeclList)state 11 4 Decl: VariableDecl . $default reduce using rule 4 (Decl)state 12 7 VariableDecl: Variable . ';' ';' shift, and go to state 21state 13 14 Type: Ident . $default reduce using rule 14 (Type)state 14 8 Variable: Type . Ident 15 Type: Type . T_Dims 22 FunctionDecl: Type . Ident '(' Formals ')' StmtBlock 24 | Type . Ident '(' ')' StmtBlock T_Dims shift, and go to state 22 T_Identifier shift, and go to state 7 Ident go to state 23state 15 5 Decl: ClassDecl . $default reduce using rule 5 (Decl)state 16 6 Decl: FunctionDecl . $default reduce using rule 6 (Decl)state 17
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -