diff --git a/Makefile b/Makefile index 02b4e29..3bb1a1f 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ all: $(BISON) $(BISON_C) $(BISON_H) $(FLEX) $(FLEX_C) $(BIN) $(TESTS) $(FLEX_C): flex $(FLEX) mv lex.yy.c $(FLEX_C) - $(CC) -fPIC -g -c $(FLEX_C) -o $(FLEX_OBJ) + $(CC) -fPIC -g -c $(FLEX_C) -o $(FLEX_OBJ) -lfl $(BISON_C): $(BISON) bison -d $(BISON) -o $(BISON_C) #-Wcounterexample $(CC) -fPIC -g -c $(BISON_C) -o $(BISON_OBJ) diff --git a/parse/topologic_parser.output b/parse/topologic_parser.output new file mode 100644 index 0000000..68e666d --- /dev/null +++ b/parse/topologic_parser.output @@ -0,0 +1,912 @@ +State 7 conflicts: 1 shift/reduce, 1 reduce/reduce + + +Grammar + + 0 $accept: json $end + + 1 $@1: %empty + + 2 json: L_BRACKET GRAPH $@1 COLON L_BRACKET content R_BRACKET R_BRACKET + + 3 content: params g + 4 | g + 5 | params + 6 | %empty + + 7 params: verb COMMA params + 8 | state COMMA params + 9 | mem_opt COMMA params + 10 | context COMMA params + 11 | max_loop COMMA params + 12 | verb + 13 | mem_opt + 14 | context + 15 | state + 16 | max_loop + 17 | %empty + + 18 state: MAX_STATE COLON VALUE + + 19 verb: LVL_VERBOSE COLON VALUE + + 20 context: LEX_CONTEXT COLON VALUE + + 21 mem_opt: MEM_OPT COLON VALUE + + 22 max_loop: MAX_LOOP COLON VALUE + + 23 g: vs COMMA es COMMA bes + 24 | vs COMMA bes COMMA es + 25 | vs COMMA es + 26 | vs COMMA bes + 27 | vs + + 28 vs: VERTICES_ COLON L_SQUARE v R_SQUARE + + 29 v: %empty + + 30 $@2: %empty + + 31 v: VALUE COMMA $@2 v + 32 | VALUE + + 33 es: EDGE_ COLON L_BRACKET e R_BRACKET + + 34 e: %empty + + 35 $@3: %empty + + 36 e: VALUE COLON VALUE COMMA $@3 e + 37 | VALUE COLON VALUE + + 38 bes: BI_EDGE_ COLON L_BRACKET be R_BRACKET + + 39 be: %empty + + 40 $@4: %empty + + 41 be: VALUE COLON VALUE COMMA $@4 be + 42 | VALUE COLON VALUE + + +Terminals, with rules where they appear + + $end (0) 0 + error (256) + L_BRACKET (258) 2 33 38 + R_BRACKET (259) 2 33 38 + GRAPH (260) 2 + COLON (261) 2 18 19 20 21 22 28 33 36 37 38 41 42 + VERTICES_ (262) 28 + EDGE_ (263) 33 + BI_EDGE_ (264) 38 + L_SQUARE (265) 28 + R_SQUARE (266) 28 + COMMA (267) 7 8 9 10 11 23 24 25 26 31 36 41 + MAX_STATE (268) 18 + LVL_VERBOSE (269) 19 + LEX_CONTEXT (270) 20 + MEM_OPT (271) 21 + MAX_LOOP (272) 22 + VALUE (273) 18 19 20 21 22 31 32 36 37 41 42 + + +Nonterminals, with rules where they appear + + $accept (19) + on left: 0 + json (20) + on left: 2 + on right: 0 + $@1 (21) + on left: 1 + on right: 2 + content (22) + on left: 3 4 5 6 + on right: 2 + params (23) + on left: 7 8 9 10 11 12 13 14 15 16 17 + on right: 3 5 7 8 9 10 11 + state (24) + on left: 18 + on right: 8 15 + verb (25) + on left: 19 + on right: 7 12 + context (26) + on left: 20 + on right: 10 14 + mem_opt (27) + on left: 21 + on right: 9 13 + max_loop (28) + on left: 22 + on right: 11 16 + g (29) + on left: 23 24 25 26 27 + on right: 3 4 + vs (30) + on left: 28 + on right: 23 24 25 26 27 + v (31) + on left: 29 31 32 + on right: 28 31 + $@2 (32) + on left: 30 + on right: 31 + es (33) + on left: 33 + on right: 23 24 25 + e (34) + on left: 34 36 37 + on right: 33 36 + $@3 (35) + on left: 35 + on right: 36 + bes (36) + on left: 38 + on right: 23 24 26 + be (37) + on left: 39 41 42 + on right: 38 41 + $@4 (38) + on left: 40 + on right: 41 + + +State 0 + + 0 $accept: • json $end + + L_BRACKET shift, and go to state 1 + + json go to state 2 + + +State 1 + + 2 json: L_BRACKET • GRAPH $@1 COLON L_BRACKET content R_BRACKET R_BRACKET + + GRAPH shift, and go to state 3 + + +State 2 + + 0 $accept: json • $end + + $end shift, and go to state 4 + + +State 3 + + 2 json: L_BRACKET GRAPH • $@1 COLON L_BRACKET content R_BRACKET R_BRACKET + + $default reduce using rule 1 ($@1) + + $@1 go to state 5 + + +State 4 + + 0 $accept: json $end • + + $default accept + + +State 5 + + 2 json: L_BRACKET GRAPH $@1 • COLON L_BRACKET content R_BRACKET R_BRACKET + + COLON shift, and go to state 6 + + +State 6 + + 2 json: L_BRACKET GRAPH $@1 COLON • L_BRACKET content R_BRACKET R_BRACKET + + L_BRACKET shift, and go to state 7 + + +State 7 + + 2 json: L_BRACKET GRAPH $@1 COLON L_BRACKET • content R_BRACKET R_BRACKET + + VERTICES_ shift, and go to state 8 + MAX_STATE shift, and go to state 9 + LVL_VERBOSE shift, and go to state 10 + LEX_CONTEXT shift, and go to state 11 + MEM_OPT shift, and go to state 12 + MAX_LOOP shift, and go to state 13 + + R_BRACKET reduce using rule 6 (content) + R_BRACKET [reduce using rule 17 (params)] + VERTICES_ [reduce using rule 17 (params)] + $default reduce using rule 6 (content) + + content go to state 14 + params go to state 15 + state go to state 16 + verb go to state 17 + context go to state 18 + mem_opt go to state 19 + max_loop go to state 20 + g go to state 21 + vs go to state 22 + + +State 8 + + 28 vs: VERTICES_ • COLON L_SQUARE v R_SQUARE + + COLON shift, and go to state 23 + + +State 9 + + 18 state: MAX_STATE • COLON VALUE + + COLON shift, and go to state 24 + + +State 10 + + 19 verb: LVL_VERBOSE • COLON VALUE + + COLON shift, and go to state 25 + + +State 11 + + 20 context: LEX_CONTEXT • COLON VALUE + + COLON shift, and go to state 26 + + +State 12 + + 21 mem_opt: MEM_OPT • COLON VALUE + + COLON shift, and go to state 27 + + +State 13 + + 22 max_loop: MAX_LOOP • COLON VALUE + + COLON shift, and go to state 28 + + +State 14 + + 2 json: L_BRACKET GRAPH $@1 COLON L_BRACKET content • R_BRACKET R_BRACKET + + R_BRACKET shift, and go to state 29 + + +State 15 + + 3 content: params • g + 5 | params • + + VERTICES_ shift, and go to state 8 + + $default reduce using rule 5 (content) + + g go to state 30 + vs go to state 22 + + +State 16 + + 8 params: state • COMMA params + 15 | state • + + COMMA shift, and go to state 31 + + $default reduce using rule 15 (params) + + +State 17 + + 7 params: verb • COMMA params + 12 | verb • + + COMMA shift, and go to state 32 + + $default reduce using rule 12 (params) + + +State 18 + + 10 params: context • COMMA params + 14 | context • + + COMMA shift, and go to state 33 + + $default reduce using rule 14 (params) + + +State 19 + + 9 params: mem_opt • COMMA params + 13 | mem_opt • + + COMMA shift, and go to state 34 + + $default reduce using rule 13 (params) + + +State 20 + + 11 params: max_loop • COMMA params + 16 | max_loop • + + COMMA shift, and go to state 35 + + $default reduce using rule 16 (params) + + +State 21 + + 4 content: g • + + $default reduce using rule 4 (content) + + +State 22 + + 23 g: vs • COMMA es COMMA bes + 24 | vs • COMMA bes COMMA es + 25 | vs • COMMA es + 26 | vs • COMMA bes + 27 | vs • + + COMMA shift, and go to state 36 + + $default reduce using rule 27 (g) + + +State 23 + + 28 vs: VERTICES_ COLON • L_SQUARE v R_SQUARE + + L_SQUARE shift, and go to state 37 + + +State 24 + + 18 state: MAX_STATE COLON • VALUE + + VALUE shift, and go to state 38 + + +State 25 + + 19 verb: LVL_VERBOSE COLON • VALUE + + VALUE shift, and go to state 39 + + +State 26 + + 20 context: LEX_CONTEXT COLON • VALUE + + VALUE shift, and go to state 40 + + +State 27 + + 21 mem_opt: MEM_OPT COLON • VALUE + + VALUE shift, and go to state 41 + + +State 28 + + 22 max_loop: MAX_LOOP COLON • VALUE + + VALUE shift, and go to state 42 + + +State 29 + + 2 json: L_BRACKET GRAPH $@1 COLON L_BRACKET content R_BRACKET • R_BRACKET + + R_BRACKET shift, and go to state 43 + + +State 30 + + 3 content: params g • + + $default reduce using rule 3 (content) + + +State 31 + + 8 params: state COMMA • params + + MAX_STATE shift, and go to state 9 + LVL_VERBOSE shift, and go to state 10 + LEX_CONTEXT shift, and go to state 11 + MEM_OPT shift, and go to state 12 + MAX_LOOP shift, and go to state 13 + + $default reduce using rule 17 (params) + + params go to state 44 + state go to state 16 + verb go to state 17 + context go to state 18 + mem_opt go to state 19 + max_loop go to state 20 + + +State 32 + + 7 params: verb COMMA • params + + MAX_STATE shift, and go to state 9 + LVL_VERBOSE shift, and go to state 10 + LEX_CONTEXT shift, and go to state 11 + MEM_OPT shift, and go to state 12 + MAX_LOOP shift, and go to state 13 + + $default reduce using rule 17 (params) + + params go to state 45 + state go to state 16 + verb go to state 17 + context go to state 18 + mem_opt go to state 19 + max_loop go to state 20 + + +State 33 + + 10 params: context COMMA • params + + MAX_STATE shift, and go to state 9 + LVL_VERBOSE shift, and go to state 10 + LEX_CONTEXT shift, and go to state 11 + MEM_OPT shift, and go to state 12 + MAX_LOOP shift, and go to state 13 + + $default reduce using rule 17 (params) + + params go to state 46 + state go to state 16 + verb go to state 17 + context go to state 18 + mem_opt go to state 19 + max_loop go to state 20 + + +State 34 + + 9 params: mem_opt COMMA • params + + MAX_STATE shift, and go to state 9 + LVL_VERBOSE shift, and go to state 10 + LEX_CONTEXT shift, and go to state 11 + MEM_OPT shift, and go to state 12 + MAX_LOOP shift, and go to state 13 + + $default reduce using rule 17 (params) + + params go to state 47 + state go to state 16 + verb go to state 17 + context go to state 18 + mem_opt go to state 19 + max_loop go to state 20 + + +State 35 + + 11 params: max_loop COMMA • params + + MAX_STATE shift, and go to state 9 + LVL_VERBOSE shift, and go to state 10 + LEX_CONTEXT shift, and go to state 11 + MEM_OPT shift, and go to state 12 + MAX_LOOP shift, and go to state 13 + + $default reduce using rule 17 (params) + + params go to state 48 + state go to state 16 + verb go to state 17 + context go to state 18 + mem_opt go to state 19 + max_loop go to state 20 + + +State 36 + + 23 g: vs COMMA • es COMMA bes + 24 | vs COMMA • bes COMMA es + 25 | vs COMMA • es + 26 | vs COMMA • bes + + EDGE_ shift, and go to state 49 + BI_EDGE_ shift, and go to state 50 + + es go to state 51 + bes go to state 52 + + +State 37 + + 28 vs: VERTICES_ COLON L_SQUARE • v R_SQUARE + + VALUE shift, and go to state 53 + + $default reduce using rule 29 (v) + + v go to state 54 + + +State 38 + + 18 state: MAX_STATE COLON VALUE • + + $default reduce using rule 18 (state) + + +State 39 + + 19 verb: LVL_VERBOSE COLON VALUE • + + $default reduce using rule 19 (verb) + + +State 40 + + 20 context: LEX_CONTEXT COLON VALUE • + + $default reduce using rule 20 (context) + + +State 41 + + 21 mem_opt: MEM_OPT COLON VALUE • + + $default reduce using rule 21 (mem_opt) + + +State 42 + + 22 max_loop: MAX_LOOP COLON VALUE • + + $default reduce using rule 22 (max_loop) + + +State 43 + + 2 json: L_BRACKET GRAPH $@1 COLON L_BRACKET content R_BRACKET R_BRACKET • + + $default reduce using rule 2 (json) + + +State 44 + + 8 params: state COMMA params • + + $default reduce using rule 8 (params) + + +State 45 + + 7 params: verb COMMA params • + + $default reduce using rule 7 (params) + + +State 46 + + 10 params: context COMMA params • + + $default reduce using rule 10 (params) + + +State 47 + + 9 params: mem_opt COMMA params • + + $default reduce using rule 9 (params) + + +State 48 + + 11 params: max_loop COMMA params • + + $default reduce using rule 11 (params) + + +State 49 + + 33 es: EDGE_ • COLON L_BRACKET e R_BRACKET + + COLON shift, and go to state 55 + + +State 50 + + 38 bes: BI_EDGE_ • COLON L_BRACKET be R_BRACKET + + COLON shift, and go to state 56 + + +State 51 + + 23 g: vs COMMA es • COMMA bes + 25 | vs COMMA es • + + COMMA shift, and go to state 57 + + $default reduce using rule 25 (g) + + +State 52 + + 24 g: vs COMMA bes • COMMA es + 26 | vs COMMA bes • + + COMMA shift, and go to state 58 + + $default reduce using rule 26 (g) + + +State 53 + + 31 v: VALUE • COMMA $@2 v + 32 | VALUE • + + COMMA shift, and go to state 59 + + $default reduce using rule 32 (v) + + +State 54 + + 28 vs: VERTICES_ COLON L_SQUARE v • R_SQUARE + + R_SQUARE shift, and go to state 60 + + +State 55 + + 33 es: EDGE_ COLON • L_BRACKET e R_BRACKET + + L_BRACKET shift, and go to state 61 + + +State 56 + + 38 bes: BI_EDGE_ COLON • L_BRACKET be R_BRACKET + + L_BRACKET shift, and go to state 62 + + +State 57 + + 23 g: vs COMMA es COMMA • bes + + BI_EDGE_ shift, and go to state 50 + + bes go to state 63 + + +State 58 + + 24 g: vs COMMA bes COMMA • es + + EDGE_ shift, and go to state 49 + + es go to state 64 + + +State 59 + + 31 v: VALUE COMMA • $@2 v + + $default reduce using rule 30 ($@2) + + $@2 go to state 65 + + +State 60 + + 28 vs: VERTICES_ COLON L_SQUARE v R_SQUARE • + + $default reduce using rule 28 (vs) + + +State 61 + + 33 es: EDGE_ COLON L_BRACKET • e R_BRACKET + + VALUE shift, and go to state 66 + + $default reduce using rule 34 (e) + + e go to state 67 + + +State 62 + + 38 bes: BI_EDGE_ COLON L_BRACKET • be R_BRACKET + + VALUE shift, and go to state 68 + + $default reduce using rule 39 (be) + + be go to state 69 + + +State 63 + + 23 g: vs COMMA es COMMA bes • + + $default reduce using rule 23 (g) + + +State 64 + + 24 g: vs COMMA bes COMMA es • + + $default reduce using rule 24 (g) + + +State 65 + + 31 v: VALUE COMMA $@2 • v + + VALUE shift, and go to state 53 + + $default reduce using rule 29 (v) + + v go to state 70 + + +State 66 + + 36 e: VALUE • COLON VALUE COMMA $@3 e + 37 | VALUE • COLON VALUE + + COLON shift, and go to state 71 + + +State 67 + + 33 es: EDGE_ COLON L_BRACKET e • R_BRACKET + + R_BRACKET shift, and go to state 72 + + +State 68 + + 41 be: VALUE • COLON VALUE COMMA $@4 be + 42 | VALUE • COLON VALUE + + COLON shift, and go to state 73 + + +State 69 + + 38 bes: BI_EDGE_ COLON L_BRACKET be • R_BRACKET + + R_BRACKET shift, and go to state 74 + + +State 70 + + 31 v: VALUE COMMA $@2 v • + + $default reduce using rule 31 (v) + + +State 71 + + 36 e: VALUE COLON • VALUE COMMA $@3 e + 37 | VALUE COLON • VALUE + + VALUE shift, and go to state 75 + + +State 72 + + 33 es: EDGE_ COLON L_BRACKET e R_BRACKET • + + $default reduce using rule 33 (es) + + +State 73 + + 41 be: VALUE COLON • VALUE COMMA $@4 be + 42 | VALUE COLON • VALUE + + VALUE shift, and go to state 76 + + +State 74 + + 38 bes: BI_EDGE_ COLON L_BRACKET be R_BRACKET • + + $default reduce using rule 38 (bes) + + +State 75 + + 36 e: VALUE COLON VALUE • COMMA $@3 e + 37 | VALUE COLON VALUE • + + COMMA shift, and go to state 77 + + $default reduce using rule 37 (e) + + +State 76 + + 41 be: VALUE COLON VALUE • COMMA $@4 be + 42 | VALUE COLON VALUE • + + COMMA shift, and go to state 78 + + $default reduce using rule 42 (be) + + +State 77 + + 36 e: VALUE COLON VALUE COMMA • $@3 e + + $default reduce using rule 35 ($@3) + + $@3 go to state 79 + + +State 78 + + 41 be: VALUE COLON VALUE COMMA • $@4 be + + $default reduce using rule 40 ($@4) + + $@4 go to state 80 + + +State 79 + + 36 e: VALUE COLON VALUE COMMA $@3 • e + + VALUE shift, and go to state 66 + + $default reduce using rule 34 (e) + + e go to state 81 + + +State 80 + + 41 be: VALUE COLON VALUE COMMA $@4 • be + + VALUE shift, and go to state 68 + + $default reduce using rule 39 (be) + + be go to state 82 + + +State 81 + + 36 e: VALUE COLON VALUE COMMA $@3 e • + + $default reduce using rule 36 (e) + + +State 82 + + 41 be: VALUE COLON VALUE COMMA $@4 be • + + $default reduce using rule 41 (be) diff --git a/parse/topologic_parser.y b/parse/topologic_parser.y index 582f90b..aaabf78 100644 --- a/parse/topologic_parser.y +++ b/parse/topologic_parser.y @@ -5,10 +5,9 @@ #include "../include/topologic.h" void f(struct graph *graph, struct vertex_result *args, void *glbl, void *edge_vars) {} int edge_f(void *args, void *glbl, const void *const edge_vars) {return 0;} -int yylex(); void yyerror(struct graph** graph, const char *s); extern FILE *yyin; -extern int yylex(void); +int yylex(void); %} %union {