📄 y.output
字号:
Terminals unused in grammar '.'Grammar 0 $accept: program $end 1 program: decls fndefs 2 fndefs: fndef 3 | fndefs fndef 4 fndef: typed_declspecs declarator compstmt 5 unop: '-' 6 | '+' 7 | '~' 8 | '!' 9 expr: nonnull_exprlist 10 exprlist: /* empty */ 11 | nonnull_exprlist 12 nonnull_exprlist: expr_no_commas 13 | nonnull_exprlist ',' expr_no_commas 14 unary_expr: primary 15 | unop cast_expr 16 cast_expr: unary_expr 17 expr_no_commas: cast_expr 18 | expr_no_commas '+' expr_no_commas 19 | expr_no_commas '-' expr_no_commas 20 | expr_no_commas '*' expr_no_commas 21 | expr_no_commas '/' expr_no_commas 22 | expr_no_commas '%' expr_no_commas 23 | expr_no_commas '=' expr_no_commas 24 | expr_no_commas '<' expr_no_commas 25 | expr_no_commas '>' expr_no_commas 26 | expr_no_commas EQ_OP expr_no_commas 27 | expr_no_commas NE_OP expr_no_commas 28 | expr_no_commas LE_OP expr_no_commas 29 | expr_no_commas GE_OP expr_no_commas 30 | expr_no_commas AND_OP expr_no_commas 31 | expr_no_commas OR_OP expr_no_commas 32 primary: IDENTIFIER 33 | CONSTANT 34 | '(' expr ')' 35 | primary '[' expr ']' 36 | primary '(' exprlist ')' 37 lineno_decl: decl 38 decls: lineno_decl 39 | decls lineno_decl 40 decl: typed_declspecs initdecls ';' 41 typed_declspecs: typespec 42 typespec: INT 43 | REAL 44 initdecls: initdcl 45 | initdecls ',' initdcl 46 initdcl: declarator '=' init 47 | declarator 48 init: expr_no_commas 49 | '{' '}' 50 | '{' initlist '}' 51 | '{' initlist ',' '}' 52 initlist: init 53 | initlist ',' init 54 declarator: notype_declarator 55 notype_declarator: IDENTIFIER 56 | notype_declarator '[' expr ']' 57 | notype_declarator '[' ']' 58 | notype_declarator '(' parmlist_or_identifiers 59 | '(' notype_declarator ')' 60 stmts: lineno_stmt_or_label 61 | stmts lineno_stmt_or_label 62 lineno_stmt_or_label: save_filename save_lineno stmt_or_label 63 stmt_or_label: stmt 64 | label 65 label: IDENTIFIER ':' 66 xstmts: /* empty */ 67 | stmts 68 compstmt: '{' decls xstmts '}' 69 | '{' xstmts '}' 70 simple_if: if_prefix lineno_labeled_stmt 71 if_prefix: IF '(' expr ')' 72 save_filename: /* empty */ 73 save_lineno: /* empty */ 74 lineno_labeled_stmt: save_filename save_lineno stmt 75 stmt: compstmt 76 | expr ';' 77 | simple_if ELSE lineno_labeled_stmt 78 | simple_if 79 | WHILE '(' expr ')' lineno_labeled_stmt 80 | WRITE '(' expr ')' ';' 81 | READ '(' identifiers ')' ';' 82 parmlist_or_identifiers: parms ')' 83 | identifiers ')' 84 | ')' 85 parms: parm 86 | parms ',' parm 87 parm: typed_declspecs notype_declarator 88 identifiers: IDENTIFIER 89 | identifiers ',' IDENTIFIERTerminals, with rules where they appear$end (0) 0'!' (33) 8'%' (37) 22'(' (40) 34 36 58 59 71 79 80 81')' (41) 34 36 59 71 79 80 81 82 83 84'*' (42) 20'+' (43) 6 18',' (44) 13 45 51 53 86 89'-' (45) 5 19'.' (46)'/' (47) 21':' (58) 65';' (59) 40 76 80 81'<' (60) 24'=' (61) 23 46'>' (62) 25'[' (91) 35 56 57']' (93) 35 56 57'{' (123) 49 50 51 68 69'}' (125) 49 50 51 68 69'~' (126) 7error (256)IDENTIFIER (258) 32 55 65 88 89CONSTANT (259) 33GE_OP (260) 29LE_OP (261) 28EQ_OP (262) 26NE_OP (263) 27AND_OP (264) 30OR_OP (265) 31INT (266) 42REAL (267) 43WHILE (268) 79WRITE (269) 80READ (270) 81IF (271) 71ELSE (272) 77UNARY (273)Nonterminals, with rules where they appear$accept (39) on left: 0program (40) on left: 1, on right: 0fndefs (41) on left: 2 3, on right: 1 3fndef (42) on left: 4, on right: 2 3unop (43) on left: 5 6 7 8, on right: 15expr (44) on left: 9, on right: 34 35 56 71 76 79 80exprlist (45) on left: 10 11, on right: 36nonnull_exprlist (46) on left: 12 13, on right: 9 11 13unary_expr (47) on left: 14 15, on right: 16cast_expr (48) on left: 16, on right: 15 17expr_no_commas (49) on left: 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31, on right: 12 13 18 19 20 21 22 23 24 25 26 27 28 29 30 31 48primary (50) on left: 32 33 34 35 36, on right: 14 35 36lineno_decl (51) on left: 37, on right: 38 39decls (52) on left: 38 39, on right: 1 39 68decl (53) on left: 40, on right: 37typed_declspecs (54) on left: 41, on right: 4 40 87typespec (55) on left: 42 43, on right: 41initdecls (56) on left: 44 45, on right: 40 45initdcl (57) on left: 46 47, on right: 44 45init (58) on left: 48 49 50 51, on right: 46 52 53initlist (59) on left: 52 53, on right: 50 51 53declarator (60) on left: 54, on right: 4 46 47notype_declarator (61) on left: 55 56 57 58 59, on right: 54 56 57 58 59 87stmts (62) on left: 60 61, on right: 61 67lineno_stmt_or_label (63) on left: 62, on right: 60 61stmt_or_label (64) on left: 63 64, on right: 62label (65) on left: 65, on right: 64xstmts (66) on left: 66 67, on right: 68 69compstmt (67) on left: 68 69, on right: 4 75simple_if (68) on left: 70, on right: 77 78if_prefix (69) on left: 71, on right: 70save_filename (70) on left: 72, on right: 62 74save_lineno (71) on left: 73, on right: 62 74lineno_labeled_stmt (72) on left: 74, on right: 70 77 79stmt (73) on left: 75 76 77 78 79 80 81, on right: 63 74parmlist_or_identifiers (74) on left: 82 83 84, on right: 58parms (75) on left: 85 86, on right: 82 86parm (76) on left: 87, on right: 85 86identifiers (77) on left: 88 89, on right: 81 83 89state 0 0 $accept: . program $end INT shift, and go to state 1 REAL shift, and go to state 2 program go to state 3 lineno_decl go to state 4 decls go to state 5 decl go to state 6 typed_declspecs go to state 7 typespec go to state 8state 1 42 typespec: INT . $default reduce using rule 42 (typespec)state 2 43 typespec: REAL . $default reduce using rule 43 (typespec)state 3 0 $accept: program . $end $end shift, and go to state 9state 4 38 decls: lineno_decl . $default reduce using rule 38 (decls)state 5 1 program: decls . fndefs 39 decls: decls . lineno_decl INT shift, and go to state 1 REAL shift, and go to state 2 fndefs go to state 10 fndef go to state 11 lineno_decl go to state 12 decl go to state 6 typed_declspecs go to state 13 typespec go to state 8state 6 37 lineno_decl: decl . $default reduce using rule 37 (lineno_decl)state 7 40 decl: typed_declspecs . initdecls ';' IDENTIFIER shift, and go to state 14 '(' shift, and go to state 15 initdecls go to state 16 initdcl go to state 17 declarator go to state 18 notype_declarator go to state 19state 8 41 typed_declspecs: typespec . $default reduce using rule 41 (typed_declspecs)state 9 0 $accept: program $end . $default acceptstate 10 1 program: decls fndefs . 3 fndefs: fndefs . fndef INT shift, and go to state 1 REAL shift, and go to state 2 $default reduce using rule 1 (program) fndef go to state 20 typed_declspecs go to state 21 typespec go to state 8state 11 2 fndefs: fndef . $default reduce using rule 2 (fndefs)state 12 39 decls: decls lineno_decl . $default reduce using rule 39 (decls)state 13 4 fndef: typed_declspecs . declarator compstmt 40 decl: typed_declspecs . initdecls ';' IDENTIFIER shift, and go to state 14 '(' shift, and go to state 15 initdecls go to state 16 initdcl go to state 17 declarator go to state 22 notype_declarator go to state 19state 14 55 notype_declarator: IDENTIFIER . $default reduce using rule 55 (notype_declarator)state 15 59 notype_declarator: '(' . notype_declarator ')' IDENTIFIER shift, and go to state 14 '(' shift, and go to state 15 notype_declarator go to state 23state 16 40 decl: typed_declspecs initdecls . ';' 45 initdecls: initdecls . ',' initdcl ',' shift, and go to state 24 ';' shift, and go to state 25state 17 44 initdecls: initdcl . $default reduce using rule 44 (initdecls)state 18 46 initdcl: declarator . '=' init 47 | declarator . '=' shift, and go to state 26 $default reduce using rule 47 (initdcl)state 19 54 declarator: notype_declarator . 56 notype_declarator: notype_declarator . '[' expr ']' 57 | notype_declarator . '[' ']' 58 | notype_declarator . '(' parmlist_or_identifiers '(' shift, and go to state 27 '[' shift, and go to state 28 $default reduce using rule 54 (declarator)state 20 3 fndefs: fndefs fndef . $default reduce using rule 3 (fndefs)state 21 4 fndef: typed_declspecs . declarator compstmt IDENTIFIER shift, and go to state 14 '(' shift, and go to state 15 declarator go to state 29 notype_declarator go to state 19state 22 4 fndef: typed_declspecs declarator . compstmt 46 initdcl: declarator . '=' init 47 | declarator . '=' shift, and go to state 26 '{' shift, and go to state 30 $default reduce using rule 47 (initdcl) compstmt go to state 31state 23 56 notype_declarator: notype_declarator . '[' expr ']' 57 | notype_declarator . '[' ']' 58 | notype_declarator . '(' parmlist_or_identifiers 59 | '(' notype_declarator . ')' '(' shift, and go to state 27 '[' shift, and go to state 28 ')' shift, and go to state 32state 24 45 initdecls: initdecls ',' . initdcl IDENTIFIER shift, and go to state 14 '(' shift, and go to state 15 initdcl go to state 33 declarator go to state 18 notype_declarator go to state 19state 25 40 decl: typed_declspecs initdecls ';' . $default reduce using rule 40 (decl)state 26 46 initdcl: declarator '=' . init IDENTIFIER shift, and go to state 34 CONSTANT shift, and go to state 35 '+' shift, and go to state 36 '-' shift, and go to state 37 '(' shift, and go to state 38 '~' shift, and go to state 39 '!' shift, and go to state 40 '{' shift, and go to state 41 unop go to state 42 unary_expr go to state 43 cast_expr go to state 44 expr_no_commas go to state 45 primary go to state 46 init go to state 47state 27 58 notype_declarator: notype_declarator '(' . parmlist_or_identifiers IDENTIFIER shift, and go to state 48 INT shift, and go to state 1 REAL shift, and go to state 2 ')' shift, and go to state 49 typed_declspecs go to state 50 typespec go to state 8 parmlist_or_identifiers go to state 51 parms go to state 52 parm go to state 53 identifiers go to state 54state 28 56 notype_declarator: notype_declarator '[' . expr ']' 57 | notype_declarator '[' . ']' IDENTIFIER shift, and go to state 34 CONSTANT shift, and go to state 35 '+' shift, and go to state 36 '-' shift, and go to state 37 '(' shift, and go to state 38 '~' shift, and go to state 39 '!' shift, and go to state 40 ']' shift, and go to state 55 unop go to state 42 expr go to state 56 nonnull_exprlist go to state 57 unary_expr go to state 43 cast_expr go to state 44 expr_no_commas go to state 58 primary go to state 46
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -