Coder Social home page Coder Social logo

c-compiler-for-a-c-like-language's Introduction

C-Compiler-for-a-C-like-language

The following is an automated report about my lexical parsing and grammar for this C compiler.

GNU Bison XML Automaton Report

input grammar: parser.y

Table of Contents

Reductions

Nonterminals useless in grammar

Terminals unused in grammar

TOK_CHAR TOK_BLOCK TOK_CALL TOK_IFELSE TOK_INITDECL TOK_POS TOK_NEG TOK_NEWARRAY TOK_FIELD TOK_ORD TOK_CHR TOK_ROOT TOK_NEWSTRING TOK_RETURNVOID TOK_VARDECL TOK_FUNCTION TOK_PARAMLIST TOK_PROTOTYPE TOK_INDEX TOK_DECLID '%'

Rules useless in grammar

Conflicts

State 66 conflicts: 13 shift/reduce State 104 conflicts: 13 shift/reduce State 123 conflicts: 1 shift/reduce

Grammar

0 $accept → start $end 1 start → program 2 program → program structdef 3 | program function 4 | program statement 5 | program error '}' 6 | program error ';' 7 | %empty 8 structdef_ellipse → '{' fielddecl ';' 9 | structdef_ellipse fielddecl ';' 10 structdef → TOK_STRUCT TOK_IDENT structdef_ellipse '}' 11 | TOK_STRUCT TOK_IDENT '{' '}' 12 fielddecl → basetype TOK_IDENT 13 | basetype TOK_ARRAY TOK_IDENT 14 basetype → TOK_VOID 15 | TOK_INT 16 | TOK_STRING 17 | TOK_TYPEID 18 | TOK_IDENT 19 function_ellipse → '(' identdecl 20 | function_ellipse ',' identdecl 21 function → identdecl function_ellipse ')' block 22 | identdecl function_ellipse ')' ';' 23 | identdecl '(' ')' block 24 | identdecl '(' ')' ';' 25 identdecl → basetype TOK_IDENT 26 | basetype TOK_ARRAY TOK_IDENT 27 block_ellipse → '{' statement 28 | block_ellipse statement 29 block → block_ellipse '}' 30 | '{' '}' 31 statement → block 32 | vardecl 33 | while 34 | ifelse 35 | return 36 | expr ';' 37 | ';' 38 vardecl → identdecl '=' expr ';' 39 while → TOK_WHILE '(' expr ')' statement 40 ifelse → TOK_IF '(' expr ')' statement TOK_ELSE statement 41 | TOK_IF '(' expr ')' statement 42 return → TOK_RETURN expr ';' 43 | TOK_RETURN ';' 44 binop → TOK_EQ 45 | TOK_NE 46 | TOK_LT 47 | TOK_LE 48 | TOK_GT 49 | TOK_GE 50 | '=' 51 | '+' 52 | '-' 53 | '*' 54 | '/' 55 unop → '+' 56 | '-' 57 | '!' 58 | TOK_NEW 59 expr → expr binop expr 60 | unop expr 61 | allocator 62 | call 63 | '(' expr ')' 64 | variable 65 | constant 66 allocator → TOK_NEW TOK_IDENT '(' ')' 67 | TOK_NEW TOK_STRING '(' expr ')' 68 | TOK_NEW basetype '[' expr ']' 69 call_elipse → TOK_IDENT '(' expr 70 | call_elipse ',' expr 71 call → call_elipse ')' 72 | TOK_IDENT '(' ')' 73 variable → TOK_IDENT 74 | expr '[' expr ']' 75 | expr '.' TOK_IDENT 76 constant → TOK_INTCON 77 | TOK_CHARCON 78 | TOK_STRINGCON 79 | TOK_NULL

Terminals, with rules where they appear

$end (0) 0 '!' (33) 57 '%' (37) '(' (40) 19 23 24 39 40 41 63 66 67 69 72 ')' (41) 21 22 23 24 39 40 41 63 66 67 71 72 '*' (42) 53 '+' (43) 51 55 ',' (44) 20 70 '-' (45) 52 56 '.' (46) 75 '/' (47) 54 ';' (59) 6 8 9 22 24 36 37 38 42 43 '=' (61) 38 50 '[' (91) 68 74 ']' (93) 68 74 '{' (123) 8 11 27 30 '}' (125) 5 10 11 29 30 error (256) 5 6 TOK_VOID (258) 14 TOK_CHAR (259) TOK_INT (260) 15 TOK_STRING (261) 16 67 TOK_IF (262) 40 41 TOK_ELSE (263) 40 TOK_WHILE (264) 39 TOK_RETURN (265) 42 43 TOK_STRUCT (266) 10 11 TOK_NULL (267) 79 TOK_NEW (268) 58 66 67 68 TOK_ARRAY (269) 13 26 TOK_EQ (270) 44 TOK_NE (271) 45 TOK_LT (272) 46 TOK_LE (273) 47 TOK_GT (274) 48 TOK_GE (275) 49 TOK_IDENT (276) 10 11 12 13 18 25 26 66 69 72 73 75 TOK_INTCON (277) 76 TOK_CHARCON (278) 77 TOK_STRINGCON (279) 78 TOK_BLOCK (280) TOK_CALL (281) TOK_IFELSE (282) TOK_INITDECL (283) TOK_POS (284) TOK_NEG (285) TOK_NEWARRAY (286) TOK_TYPEID (287) 17 TOK_FIELD (288) TOK_ORD (289) TOK_CHR (290) TOK_ROOT (291) TOK_NEWSTRING (292) TOK_RETURNVOID (293) TOK_VARDECL (294) TOK_FUNCTION (295) TOK_PARAMLIST (296) TOK_PROTOTYPE (297) TOK_INDEX (298) TOK_DECLID (299)

Nonterminals, with rules where they appear

$accept (61) on left: 0 start (62) on left: 1 on right: 0 program (63) on left: 2 3 4 5 6 7 on right: 1 2 3 4 5 6 structdef_ellipse (64) on left: 8 9 on right: 9 10 structdef (65) on left: 10 11 on right: 2 fielddecl (66) on left: 12 13 on right: 8 9 basetype (67) on left: 14 15 16 17 18 on right: 12 13 25 26 68 function_ellipse (68) on left: 19 20 on right: 20 21 22 function (69) on left: 21 22 23 24 on right: 3 identdecl (70) on left: 25 26 on right: 19 20 21 22 23 24 38 block_ellipse (71) on left: 27 28 on right: 28 29 block (72) on left: 29 30 on right: 21 23 31 statement (73) on left: 31 32 33 34 35 36 37 on right: 4 27 28 39 40 41 vardecl (74) on left: 38 on right: 32 while (75) on left: 39 on right: 33 ifelse (76) on left: 40 41 on right: 34 return (77) on left: 42 43 on right: 35 binop (78) on left: 44 45 46 47 48 49 50 51 52 53 54 on right: 59 unop (79) on left: 55 56 57 58 on right: 60 expr (80) on left: 59 60 61 62 63 64 65 on right: 36 38 39 40 41 42 59 60 63 67 68 69 70 74 75 allocator (81) on left: 66 67 68 on right: 61 call_elipse (82) on left: 69 70 on right: 70 71 call (83) on left: 71 72 on right: 62 variable (84) on left: 73 74 75 on right: 64 constant (85) on left: 76 77 78 79 on right: 65

Automaton

state 0

0 $accept → . start $end 1 start → . program 2 program → . program structdef 3 | . program function 4 | . program statement 5 | . program error '}' 6 | . program error ';' 7 | . %empty $default reduce using rule 7 (program) start go to state 1 program go to state 2

state 1

0 $accept → start . $end $end shift, and go to state 3

state 2

1 start → program . [$end] 2 program → program . structdef 3 | program . function 4 | program . statement 5 | program . error '}' 6 | program . error ';' 10 structdef → . TOK_STRUCT TOK_IDENT structdef_ellipse '}' 11 | . TOK_STRUCT TOK_IDENT '{' '}' 14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT 21 function → . identdecl function_ellipse ')' block 22 | . identdecl function_ellipse ')' ';' 23 | . identdecl '(' ')' block 24 | . identdecl '(' ')' ';' 25 identdecl → . basetype TOK_IDENT 26 | . basetype TOK_ARRAY TOK_IDENT 27 block_ellipse → . '{' statement 28 | . block_ellipse statement 29 block → . block_ellipse '}' 30 | . '{' '}' 31 statement → . block 32 | . vardecl 33 | . while 34 | . ifelse 35 | . return 36 | . expr ';' 37 | . ';' 38 vardecl → . identdecl '=' expr ';' 39 while → . TOK_WHILE '(' expr ')' statement 40 ifelse → . TOK_IF '(' expr ')' statement TOK_ELSE statement 41 | . TOK_IF '(' expr ')' statement 42 return → . TOK_RETURN expr ';' 43 | . TOK_RETURN ';' 55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL error shift, and go to state 4 TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 7 TOK_IF shift, and go to state 8 TOK_WHILE shift, and go to state 9 TOK_RETURN shift, and go to state 10 TOK_STRUCT shift, and go to state 11 TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 14 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 TOK_TYPEID shift, and go to state 18 '+' shift, and go to state 19 '-' shift, and go to state 20 '{' shift, and go to state 21 '!' shift, and go to state 22 ';' shift, and go to state 23 '(' shift, and go to state 24 $end reduce using rule 1 (start) structdef go to state 25 basetype go to state 26 function go to state 27 identdecl go to state 28 block_ellipse go to state 29 block go to state 30 statement go to state 31 vardecl go to state 32 while go to state 33 ifelse go to state 34 return go to state 35 unop go to state 36 expr go to state 37 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 3

0 $accept → start $end . $default accept

state 4

5 program → program error . '}' 6 | program error . ';' '}' shift, and go to state 43 ';' shift, and go to state 44

state 5

14 basetype → TOK_VOID . $default reduce using rule 14 (basetype)

state 6

15 basetype → TOK_INT . $default reduce using rule 15 (basetype)

state 7

16 basetype → TOK_STRING . $default reduce using rule 16 (basetype)

state 8

40 ifelse → TOK_IF . '(' expr ')' statement TOK_ELSE statement 41 | TOK_IF . '(' expr ')' statement '(' shift, and go to state 45

state 9

39 while → TOK_WHILE . '(' expr ')' statement '(' shift, and go to state 46

state 10

42 return → TOK_RETURN . expr ';' 43 | TOK_RETURN . ';' 55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 ';' shift, and go to state 48 '(' shift, and go to state 24 unop go to state 36 expr go to state 49 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 11

10 structdef → TOK_STRUCT . TOK_IDENT structdef_ellipse '}' 11 | TOK_STRUCT . TOK_IDENT '{' '}' TOK_IDENT shift, and go to state 50

state 12

79 constant → TOK_NULL . $default reduce using rule 79 (constant)

state 13

14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT 58 unop → TOK_NEW . [TOK_NULL, TOK_NEW, TOK_INTCON, TOK_CHARCON, TOK_STRINGCON, '+', '-', '!', '('] 66 allocator → TOK_NEW . TOK_IDENT '(' ')' 67 | TOK_NEW . TOK_STRING '(' expr ')' 68 | TOK_NEW . basetype '[' expr ']' TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 51 TOK_IDENT shift, and go to state 52 TOK_TYPEID shift, and go to state 18 $default reduce using rule 58 (unop) basetype go to state 53 Conflict between rule 58 and token TOK_IDENT resolved as shift (TOK_NEW < TOK_IDENT).

state 14

18 basetype → TOK_IDENT . [TOK_ARRAY, TOK_IDENT] 69 call_elipse → TOK_IDENT . '(' expr 72 call → TOK_IDENT . '(' ')' 73 variable → TOK_IDENT . [TOK_EQ, TOK_NE, TOK_LT, TOK_LE, TOK_GT, TOK_GE, '=', '+', '-', '*', '/', '.', ';', '['] '(' shift, and go to state 54 TOK_ARRAY reduce using rule 18 (basetype) TOK_IDENT reduce using rule 18 (basetype) $default reduce using rule 73 (variable)

state 15

76 constant → TOK_INTCON . $default reduce using rule 76 (constant)

state 16

77 constant → TOK_CHARCON . $default reduce using rule 77 (constant)

state 17

78 constant → TOK_STRINGCON . $default reduce using rule 78 (constant)

state 18

17 basetype → TOK_TYPEID . $default reduce using rule 17 (basetype)

state 19

55 unop → '+' . $default reduce using rule 55 (unop)

state 20

56 unop → '-' . $default reduce using rule 56 (unop)

state 21

14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT 25 identdecl → . basetype TOK_IDENT 26 | . basetype TOK_ARRAY TOK_IDENT 27 block_ellipse → . '{' statement 27 | '{' . statement 28 | . block_ellipse statement 29 block → . block_ellipse '}' 30 | . '{' '}' 30 | '{' . '}' 31 statement → . block 32 | . vardecl 33 | . while 34 | . ifelse 35 | . return 36 | . expr ';' 37 | . ';' 38 vardecl → . identdecl '=' expr ';' 39 while → . TOK_WHILE '(' expr ')' statement 40 ifelse → . TOK_IF '(' expr ')' statement TOK_ELSE statement 41 | . TOK_IF '(' expr ')' statement 42 return → . TOK_RETURN expr ';' 43 | . TOK_RETURN ';' 55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 7 TOK_IF shift, and go to state 8 TOK_WHILE shift, and go to state 9 TOK_RETURN shift, and go to state 10 TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 14 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 TOK_TYPEID shift, and go to state 18 '+' shift, and go to state 19 '-' shift, and go to state 20 '{' shift, and go to state 21 '!' shift, and go to state 22 '}' shift, and go to state 55 ';' shift, and go to state 23 '(' shift, and go to state 24 basetype go to state 26 identdecl go to state 56 block_ellipse go to state 29 block go to state 30 statement go to state 57 vardecl go to state 32 while go to state 33 ifelse go to state 34 return go to state 35 unop go to state 36 expr go to state 37 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 22

57 unop → '!' . $default reduce using rule 57 (unop)

state 23

37 statement → ';' . $default reduce using rule 37 (statement)

state 24

55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 63 | '(' . expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 unop go to state 36 expr go to state 58 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 25

2 program → program structdef . $default reduce using rule 2 (program)

state 26

25 identdecl → basetype . TOK_IDENT 26 | basetype . TOK_ARRAY TOK_IDENT TOK_ARRAY shift, and go to state 59 TOK_IDENT shift, and go to state 60

state 27

3 program → program function . $default reduce using rule 3 (program)

state 28

19 function_ellipse → . '(' identdecl 20 | . function_ellipse ',' identdecl 21 function → identdecl . function_ellipse ')' block 22 | identdecl . function_ellipse ')' ';' 23 | identdecl . '(' ')' block 24 | identdecl . '(' ')' ';' 38 vardecl → identdecl . '=' expr ';' '=' shift, and go to state 61 '(' shift, and go to state 62 function_ellipse go to state 63

state 29

14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT 25 identdecl → . basetype TOK_IDENT 26 | . basetype TOK_ARRAY TOK_IDENT 27 block_ellipse → . '{' statement 28 | . block_ellipse statement 28 | block_ellipse . statement 29 block → . block_ellipse '}' 29 | block_ellipse . '}' 30 | . '{' '}' 31 statement → . block 32 | . vardecl 33 | . while 34 | . ifelse 35 | . return 36 | . expr ';' 37 | . ';' 38 vardecl → . identdecl '=' expr ';' 39 while → . TOK_WHILE '(' expr ')' statement 40 ifelse → . TOK_IF '(' expr ')' statement TOK_ELSE statement 41 | . TOK_IF '(' expr ')' statement 42 return → . TOK_RETURN expr ';' 43 | . TOK_RETURN ';' 55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 7 TOK_IF shift, and go to state 8 TOK_WHILE shift, and go to state 9 TOK_RETURN shift, and go to state 10 TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 14 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 TOK_TYPEID shift, and go to state 18 '+' shift, and go to state 19 '-' shift, and go to state 20 '{' shift, and go to state 21 '!' shift, and go to state 22 '}' shift, and go to state 64 ';' shift, and go to state 23 '(' shift, and go to state 24 basetype go to state 26 identdecl go to state 56 block_ellipse go to state 29 block go to state 30 statement go to state 65 vardecl go to state 32 while go to state 33 ifelse go to state 34 return go to state 35 unop go to state 36 expr go to state 37 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 30

31 statement → block . $default reduce using rule 31 (statement)

state 31

4 program → program statement . $default reduce using rule 4 (program)

state 32

32 statement → vardecl . $default reduce using rule 32 (statement)

state 33

33 statement → while . $default reduce using rule 33 (statement)

state 34

34 statement → ifelse . $default reduce using rule 34 (statement)

state 35

35 statement → return . $default reduce using rule 35 (statement)

state 36

55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 60 | unop . expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 unop go to state 36 expr go to state 66 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 37

36 statement → expr . ';' 44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 ';' shift, and go to state 79 '[' shift, and go to state 80 binop go to state 81

state 38

61 expr → allocator . $default reduce using rule 61 (expr)

state 39

70 call_elipse → call_elipse . ',' expr 71 call → call_elipse . ')' ',' shift, and go to state 82 ')' shift, and go to state 83

state 40

62 expr → call . $default reduce using rule 62 (expr)

state 41

64 expr → variable . $default reduce using rule 64 (expr)

state 42

65 expr → constant . $default reduce using rule 65 (expr)

state 43

5 program → program error '}' . $default reduce using rule 5 (program)

state 44

6 program → program error ';' . $default reduce using rule 6 (program)

state 45

40 ifelse → TOK_IF '(' . expr ')' statement TOK_ELSE statement 41 | TOK_IF '(' . expr ')' statement 55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 unop go to state 36 expr go to state 84 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 46

39 while → TOK_WHILE '(' . expr ')' statement 55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 unop go to state 36 expr go to state 85 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 47

69 call_elipse → TOK_IDENT . '(' expr 72 call → TOK_IDENT . '(' ')' 73 variable → TOK_IDENT . [TOK_EQ, TOK_NE, TOK_LT, TOK_LE, TOK_GT, TOK_GE, '=', '+', '-', '*', '/', '.', ';', ',', ')', '[', ']'] '(' shift, and go to state 54 $default reduce using rule 73 (variable)

state 48

43 return → TOK_RETURN ';' . $default reduce using rule 43 (return)

state 49

42 return → TOK_RETURN expr . ';' 44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 ';' shift, and go to state 86 '[' shift, and go to state 80 binop go to state 81

state 50

8 structdef_ellipse → . '{' fielddecl ';' 9 | . structdef_ellipse fielddecl ';' 10 structdef → TOK_STRUCT TOK_IDENT . structdef_ellipse '}' 11 | TOK_STRUCT TOK_IDENT . '{' '}' '{' shift, and go to state 87 structdef_ellipse go to state 88

state 51

16 basetype → TOK_STRING . ['['] 67 allocator → TOK_NEW TOK_STRING . '(' expr ')' '(' shift, and go to state 89 $default reduce using rule 16 (basetype)

state 52

18 basetype → TOK_IDENT . ['['] 66 allocator → TOK_NEW TOK_IDENT . '(' ')' '(' shift, and go to state 90 $default reduce using rule 18 (basetype)

state 53

68 allocator → TOK_NEW basetype . '[' expr ']' '[' shift, and go to state 91

state 54

55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 69 | TOK_IDENT '(' . expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 72 | TOK_IDENT '(' . ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 ')' shift, and go to state 92 unop go to state 36 expr go to state 93 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 55

30 block → '{' '}' . $default reduce using rule 30 (block)

state 56

38 vardecl → identdecl . '=' expr ';' '=' shift, and go to state 61

state 57

27 block_ellipse → '{' statement . $default reduce using rule 27 (block_ellipse)

state 58

44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 63 | '(' expr . ')' 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 ')' shift, and go to state 94 '[' shift, and go to state 80 binop go to state 81

state 59

26 identdecl → basetype TOK_ARRAY . TOK_IDENT TOK_IDENT shift, and go to state 95

state 60

25 identdecl → basetype TOK_IDENT . $default reduce using rule 25 (identdecl)

state 61

38 vardecl → identdecl '=' . expr ';' 55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 unop go to state 36 expr go to state 96 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 62

14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT 19 function_ellipse → '(' . identdecl 23 function → identdecl '(' . ')' block 24 | identdecl '(' . ')' ';' 25 identdecl → . basetype TOK_IDENT 26 | . basetype TOK_ARRAY TOK_IDENT TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 7 TOK_IDENT shift, and go to state 97 TOK_TYPEID shift, and go to state 18 ')' shift, and go to state 98 basetype go to state 26 identdecl go to state 99

state 63

20 function_ellipse → function_ellipse . ',' identdecl 21 function → identdecl function_ellipse . ')' block 22 | identdecl function_ellipse . ')' ';' ',' shift, and go to state 100 ')' shift, and go to state 101

state 64

29 block → block_ellipse '}' . $default reduce using rule 29 (block)

state 65

28 block_ellipse → block_ellipse statement . $default reduce using rule 28 (block_ellipse)

state 66

44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 60 | unop expr . [TOK_EQ, TOK_NE, TOK_LT, TOK_LE, TOK_GT, TOK_GE, '=', '+', '-', '*', '/', '.', ';', ',', ')', '[', ']'] 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 '[' shift, and go to state 80 TOK_EQ [reduce using rule 60 (expr)] TOK_NE [reduce using rule 60 (expr)] TOK_LT [reduce using rule 60 (expr)] TOK_LE [reduce using rule 60 (expr)] TOK_GT [reduce using rule 60 (expr)] TOK_GE [reduce using rule 60 (expr)] '=' [reduce using rule 60 (expr)] '+' [reduce using rule 60 (expr)] '-' [reduce using rule 60 (expr)] '*' [reduce using rule 60 (expr)] '/' [reduce using rule 60 (expr)] '.' [reduce using rule 60 (expr)] '[' [reduce using rule 60 (expr)] $default reduce using rule 60 (expr) binop go to state 81

state 67

44 binop → TOK_EQ . $default reduce using rule 44 (binop)

state 68

45 binop → TOK_NE . $default reduce using rule 45 (binop)

state 69

46 binop → TOK_LT . $default reduce using rule 46 (binop)

state 70

47 binop → TOK_LE . $default reduce using rule 47 (binop)

state 71

48 binop → TOK_GT . $default reduce using rule 48 (binop)

state 72

49 binop → TOK_GE . $default reduce using rule 49 (binop)

state 73

50 binop → '=' . $default reduce using rule 50 (binop)

state 74

51 binop → '+' . $default reduce using rule 51 (binop)

state 75

52 binop → '-' . $default reduce using rule 52 (binop)

state 76

53 binop → '*' . $default reduce using rule 53 (binop)

state 77

54 binop → '/' . $default reduce using rule 54 (binop)

state 78

75 variable → expr '.' . TOK_IDENT TOK_IDENT shift, and go to state 102

state 79

36 statement → expr ';' . $default reduce using rule 36 (statement)

state 80

55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 74 | expr '[' . expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 unop go to state 36 expr go to state 103 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 81

55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 59 | expr binop . expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 unop go to state 36 expr go to state 104 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 82

55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 70 | call_elipse ',' . expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 unop go to state 36 expr go to state 105 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 83

71 call → call_elipse ')' . $default reduce using rule 71 (call)

state 84

40 ifelse → TOK_IF '(' expr . ')' statement TOK_ELSE statement 41 | TOK_IF '(' expr . ')' statement 44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 ')' shift, and go to state 106 '[' shift, and go to state 80 binop go to state 81

state 85

39 while → TOK_WHILE '(' expr . ')' statement 44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 ')' shift, and go to state 107 '[' shift, and go to state 80 binop go to state 81

state 86

42 return → TOK_RETURN expr ';' . $default reduce using rule 42 (return)

state 87

8 structdef_ellipse → '{' . fielddecl ';' 11 structdef → TOK_STRUCT TOK_IDENT '{' . '}' 12 fielddecl → . basetype TOK_IDENT 13 | . basetype TOK_ARRAY TOK_IDENT 14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 7 TOK_IDENT shift, and go to state 97 TOK_TYPEID shift, and go to state 18 '}' shift, and go to state 108 fielddecl go to state 109 basetype go to state 110

state 88

9 structdef_ellipse → structdef_ellipse . fielddecl ';' 10 structdef → TOK_STRUCT TOK_IDENT structdef_ellipse . '}' 12 fielddecl → . basetype TOK_IDENT 13 | . basetype TOK_ARRAY TOK_IDENT 14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 7 TOK_IDENT shift, and go to state 97 TOK_TYPEID shift, and go to state 18 '}' shift, and go to state 111 fielddecl go to state 112 basetype go to state 110

state 89

55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 67 | TOK_NEW TOK_STRING '(' . expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 unop go to state 36 expr go to state 113 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 90

66 allocator → TOK_NEW TOK_IDENT '(' . ')' ')' shift, and go to state 114

state 91

55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 68 | TOK_NEW basetype '[' . expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 47 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 '+' shift, and go to state 19 '-' shift, and go to state 20 '!' shift, and go to state 22 '(' shift, and go to state 24 unop go to state 36 expr go to state 115 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 92

72 call → TOK_IDENT '(' ')' . $default reduce using rule 72 (call)

state 93

44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 69 call_elipse → TOK_IDENT '(' expr . [',', ')'] 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 '[' shift, and go to state 80 $default reduce using rule 69 (call_elipse) binop go to state 81

state 94

63 expr → '(' expr ')' . $default reduce using rule 63 (expr)

state 95

26 identdecl → basetype TOK_ARRAY TOK_IDENT . $default reduce using rule 26 (identdecl)

state 96

38 vardecl → identdecl '=' expr . ';' 44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 ';' shift, and go to state 116 '[' shift, and go to state 80 binop go to state 81

state 97

18 basetype → TOK_IDENT . $default reduce using rule 18 (basetype)

state 98

23 function → identdecl '(' ')' . block 24 | identdecl '(' ')' . ';' 27 block_ellipse → . '{' statement 28 | . block_ellipse statement 29 block → . block_ellipse '}' 30 | . '{' '}' '{' shift, and go to state 21 ';' shift, and go to state 117 block_ellipse go to state 29 block go to state 118

state 99

19 function_ellipse → '(' identdecl . $default reduce using rule 19 (function_ellipse)

state 100

14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT 20 function_ellipse → function_ellipse ',' . identdecl 25 identdecl → . basetype TOK_IDENT 26 | . basetype TOK_ARRAY TOK_IDENT TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 7 TOK_IDENT shift, and go to state 97 TOK_TYPEID shift, and go to state 18 basetype go to state 26 identdecl go to state 119

state 101

21 function → identdecl function_ellipse ')' . block 22 | identdecl function_ellipse ')' . ';' 27 block_ellipse → . '{' statement 28 | . block_ellipse statement 29 block → . block_ellipse '}' 30 | . '{' '}' '{' shift, and go to state 21 ';' shift, and go to state 120 block_ellipse go to state 29 block go to state 121

state 102

75 variable → expr '.' TOK_IDENT . $default reduce using rule 75 (variable)

state 103

44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 74 variable → expr . '[' expr ']' 74 | expr '[' expr . ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 '[' shift, and go to state 80 ']' shift, and go to state 122 binop go to state 81

state 104

44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 59 | expr binop expr . [TOK_EQ, TOK_NE, TOK_LT, TOK_LE, TOK_GT, TOK_GE, '=', '+', '-', '*', '/', '.', ';', ',', ')', '[', ']'] 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 '[' shift, and go to state 80 TOK_EQ [reduce using rule 59 (expr)] TOK_NE [reduce using rule 59 (expr)] TOK_LT [reduce using rule 59 (expr)] TOK_LE [reduce using rule 59 (expr)] TOK_GT [reduce using rule 59 (expr)] TOK_GE [reduce using rule 59 (expr)] '=' [reduce using rule 59 (expr)] '+' [reduce using rule 59 (expr)] '-' [reduce using rule 59 (expr)] '*' [reduce using rule 59 (expr)] '/' [reduce using rule 59 (expr)] '.' [reduce using rule 59 (expr)] '[' [reduce using rule 59 (expr)] $default reduce using rule 59 (expr) binop go to state 81

state 105

44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 70 call_elipse → call_elipse ',' expr . [',', ')'] 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 '[' shift, and go to state 80 $default reduce using rule 70 (call_elipse) binop go to state 81

state 106

14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT 25 identdecl → . basetype TOK_IDENT 26 | . basetype TOK_ARRAY TOK_IDENT 27 block_ellipse → . '{' statement 28 | . block_ellipse statement 29 block → . block_ellipse '}' 30 | . '{' '}' 31 statement → . block 32 | . vardecl 33 | . while 34 | . ifelse 35 | . return 36 | . expr ';' 37 | . ';' 38 vardecl → . identdecl '=' expr ';' 39 while → . TOK_WHILE '(' expr ')' statement 40 ifelse → . TOK_IF '(' expr ')' statement TOK_ELSE statement 40 | TOK_IF '(' expr ')' . statement TOK_ELSE statement 41 | . TOK_IF '(' expr ')' statement 41 | TOK_IF '(' expr ')' . statement 42 return → . TOK_RETURN expr ';' 43 | . TOK_RETURN ';' 55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 7 TOK_IF shift, and go to state 8 TOK_WHILE shift, and go to state 9 TOK_RETURN shift, and go to state 10 TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 14 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 TOK_TYPEID shift, and go to state 18 '+' shift, and go to state 19 '-' shift, and go to state 20 '{' shift, and go to state 21 '!' shift, and go to state 22 ';' shift, and go to state 23 '(' shift, and go to state 24 basetype go to state 26 identdecl go to state 56 block_ellipse go to state 29 block go to state 30 statement go to state 123 vardecl go to state 32 while go to state 33 ifelse go to state 34 return go to state 35 unop go to state 36 expr go to state 37 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 107

14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT 25 identdecl → . basetype TOK_IDENT 26 | . basetype TOK_ARRAY TOK_IDENT 27 block_ellipse → . '{' statement 28 | . block_ellipse statement 29 block → . block_ellipse '}' 30 | . '{' '}' 31 statement → . block 32 | . vardecl 33 | . while 34 | . ifelse 35 | . return 36 | . expr ';' 37 | . ';' 38 vardecl → . identdecl '=' expr ';' 39 while → . TOK_WHILE '(' expr ')' statement 39 | TOK_WHILE '(' expr ')' . statement 40 ifelse → . TOK_IF '(' expr ')' statement TOK_ELSE statement 41 | . TOK_IF '(' expr ')' statement 42 return → . TOK_RETURN expr ';' 43 | . TOK_RETURN ';' 55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 7 TOK_IF shift, and go to state 8 TOK_WHILE shift, and go to state 9 TOK_RETURN shift, and go to state 10 TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 14 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 TOK_TYPEID shift, and go to state 18 '+' shift, and go to state 19 '-' shift, and go to state 20 '{' shift, and go to state 21 '!' shift, and go to state 22 ';' shift, and go to state 23 '(' shift, and go to state 24 basetype go to state 26 identdecl go to state 56 block_ellipse go to state 29 block go to state 30 statement go to state 124 vardecl go to state 32 while go to state 33 ifelse go to state 34 return go to state 35 unop go to state 36 expr go to state 37 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 108

11 structdef → TOK_STRUCT TOK_IDENT '{' '}' . $default reduce using rule 11 (structdef)

state 109

8 structdef_ellipse → '{' fielddecl . ';' ';' shift, and go to state 125

state 110

12 fielddecl → basetype . TOK_IDENT 13 | basetype . TOK_ARRAY TOK_IDENT TOK_ARRAY shift, and go to state 126 TOK_IDENT shift, and go to state 127

state 111

10 structdef → TOK_STRUCT TOK_IDENT structdef_ellipse '}' . $default reduce using rule 10 (structdef)

state 112

9 structdef_ellipse → structdef_ellipse fielddecl . ';' ';' shift, and go to state 128

state 113

44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 67 allocator → TOK_NEW TOK_STRING '(' expr . ')' 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 ')' shift, and go to state 129 '[' shift, and go to state 80 binop go to state 81

state 114

66 allocator → TOK_NEW TOK_IDENT '(' ')' . $default reduce using rule 66 (allocator)

state 115

44 binop → . TOK_EQ 45 | . TOK_NE 46 | . TOK_LT 47 | . TOK_LE 48 | . TOK_GT 49 | . TOK_GE 50 | . '=' 51 | . '+' 52 | . '-' 53 | . '*' 54 | . '/' 59 expr → expr . binop expr 68 allocator → TOK_NEW basetype '[' expr . ']' 74 variable → expr . '[' expr ']' 75 | expr . '.' TOK_IDENT TOK_EQ shift, and go to state 67 TOK_NE shift, and go to state 68 TOK_LT shift, and go to state 69 TOK_LE shift, and go to state 70 TOK_GT shift, and go to state 71 TOK_GE shift, and go to state 72 '=' shift, and go to state 73 '+' shift, and go to state 74 '-' shift, and go to state 75 '*' shift, and go to state 76 '/' shift, and go to state 77 '.' shift, and go to state 78 '[' shift, and go to state 80 ']' shift, and go to state 130 binop go to state 81

state 116

38 vardecl → identdecl '=' expr ';' . $default reduce using rule 38 (vardecl)

state 117

24 function → identdecl '(' ')' ';' . $default reduce using rule 24 (function)

state 118

23 function → identdecl '(' ')' block . $default reduce using rule 23 (function)

state 119

20 function_ellipse → function_ellipse ',' identdecl . $default reduce using rule 20 (function_ellipse)

state 120

22 function → identdecl function_ellipse ')' ';' . $default reduce using rule 22 (function)

state 121

21 function → identdecl function_ellipse ')' block . $default reduce using rule 21 (function)

state 122

74 variable → expr '[' expr ']' . $default reduce using rule 74 (variable)

state 123

40 ifelse → TOK_IF '(' expr ')' statement . TOK_ELSE statement 41 | TOK_IF '(' expr ')' statement . [$end, error, TOK_VOID, TOK_INT, TOK_STRING, TOK_IF, TOK_ELSE, TOK_WHILE, TOK_RETURN, TOK_STRUCT, TOK_NULL, TOK_NEW, TOK_IDENT, TOK_INTCON, TOK_CHARCON, TOK_STRINGCON, TOK_TYPEID, '+', '-', '{', '!', '}', ';', '('] TOK_ELSE shift, and go to state 131 TOK_ELSE [reduce using rule 41 (ifelse)] $default reduce using rule 41 (ifelse)

state 124

39 while → TOK_WHILE '(' expr ')' statement . $default reduce using rule 39 (while)

state 125

8 structdef_ellipse → '{' fielddecl ';' . $default reduce using rule 8 (structdef_ellipse)

state 126

13 fielddecl → basetype TOK_ARRAY . TOK_IDENT TOK_IDENT shift, and go to state 132

state 127

12 fielddecl → basetype TOK_IDENT . $default reduce using rule 12 (fielddecl)

state 128

9 structdef_ellipse → structdef_ellipse fielddecl ';' . $default reduce using rule 9 (structdef_ellipse)

state 129

67 allocator → TOK_NEW TOK_STRING '(' expr ')' . $default reduce using rule 67 (allocator)

state 130

68 allocator → TOK_NEW basetype '[' expr ']' . $default reduce using rule 68 (allocator)

state 131

14 basetype → . TOK_VOID 15 | . TOK_INT 16 | . TOK_STRING 17 | . TOK_TYPEID 18 | . TOK_IDENT 25 identdecl → . basetype TOK_IDENT 26 | . basetype TOK_ARRAY TOK_IDENT 27 block_ellipse → . '{' statement 28 | . block_ellipse statement 29 block → . block_ellipse '}' 30 | . '{' '}' 31 statement → . block 32 | . vardecl 33 | . while 34 | . ifelse 35 | . return 36 | . expr ';' 37 | . ';' 38 vardecl → . identdecl '=' expr ';' 39 while → . TOK_WHILE '(' expr ')' statement 40 ifelse → . TOK_IF '(' expr ')' statement TOK_ELSE statement 40 | TOK_IF '(' expr ')' statement TOK_ELSE . statement 41 | . TOK_IF '(' expr ')' statement 42 return → . TOK_RETURN expr ';' 43 | . TOK_RETURN ';' 55 unop → . '+' 56 | . '-' 57 | . '!' 58 | . TOK_NEW 59 expr → . expr binop expr 60 | . unop expr 61 | . allocator 62 | . call 63 | . '(' expr ')' 64 | . variable 65 | . constant 66 allocator → . TOK_NEW TOK_IDENT '(' ')' 67 | . TOK_NEW TOK_STRING '(' expr ')' 68 | . TOK_NEW basetype '[' expr ']' 69 call_elipse → . TOK_IDENT '(' expr 70 | . call_elipse ',' expr 71 call → . call_elipse ')' 72 | . TOK_IDENT '(' ')' 73 variable → . TOK_IDENT 74 | . expr '[' expr ']' 75 | . expr '.' TOK_IDENT 76 constant → . TOK_INTCON 77 | . TOK_CHARCON 78 | . TOK_STRINGCON 79 | . TOK_NULL TOK_VOID shift, and go to state 5 TOK_INT shift, and go to state 6 TOK_STRING shift, and go to state 7 TOK_IF shift, and go to state 8 TOK_WHILE shift, and go to state 9 TOK_RETURN shift, and go to state 10 TOK_NULL shift, and go to state 12 TOK_NEW shift, and go to state 13 TOK_IDENT shift, and go to state 14 TOK_INTCON shift, and go to state 15 TOK_CHARCON shift, and go to state 16 TOK_STRINGCON shift, and go to state 17 TOK_TYPEID shift, and go to state 18 '+' shift, and go to state 19 '-' shift, and go to state 20 '{' shift, and go to state 21 '!' shift, and go to state 22 ';' shift, and go to state 23 '(' shift, and go to state 24 basetype go to state 26 identdecl go to state 56 block_ellipse go to state 29 block go to state 30 statement go to state 133 vardecl go to state 32 while go to state 33 ifelse go to state 34 return go to state 35 unop go to state 36 expr go to state 37 allocator go to state 38 call_elipse go to state 39 call go to state 40 variable go to state 41 constant go to state 42

state 132

13 fielddecl → basetype TOK_ARRAY TOK_IDENT . $default reduce using rule 13 (fielddecl)

state 133

40 ifelse → TOK_IF '(' expr ')' statement TOK_ELSE statement . $default reduce using rule 40 (ifelse)


This document was generated using GNU Bison 3.0.4 XML Automaton Report.
Verbatim copying and distribution of this entire page is permitted in any medium, provided this notice is preserved.

c-compiler-for-a-c-like-language's People

Contributors

jamcircuit avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.