From 030517f49274e5bb4ff10971a18f9229b8eaaa41 Mon Sep 17 00:00:00 2001 From: Dimitar Trendafilov Date: Wed, 24 Oct 2018 21:52:24 +0300 Subject: added debug for the bison parser --- demo/bison/calc/Makefile | 18 +- demo/bison/calc/parser.dot | 77 ++++++++ demo/bison/calc/parser.html | 334 +++++++++++++++++++++++++++++++ demo/bison/calc/parser.svg | 459 +++++++++++++++++++++++++++++++++++++++++++ demo/bison/calc/parser.tab.c | 41 ++-- demo/bison/calc/parser.tab.h | 2 +- demo/bison/calc/parser.y | 1 + 7 files changed, 907 insertions(+), 25 deletions(-) create mode 100644 demo/bison/calc/parser.dot create mode 100644 demo/bison/calc/parser.html create mode 100644 demo/bison/calc/parser.svg diff --git a/demo/bison/calc/Makefile b/demo/bison/calc/Makefile index ba07ca1..4f417cf 100644 --- a/demo/bison/calc/Makefile +++ b/demo/bison/calc/Makefile @@ -1,13 +1,23 @@ all: calc +BISON_DATA_DIR=$(shell bison --print-datadir) + lex.yy.c: lexer.lex flex lexer.lex parser.tab.c: parser.y - bison ${DEBUG} -v -d parser.y + bison ${DEBUG} -x -d parser.y + +parser.tab.h: parser.tab.c + +parser.html: parser.tab.c + xsltproc ${BISON_DATA_DIR}/xslt/xml2xhtml.xsl parser.xml > parser.html + +parser.dot: parser.tab.c + xsltproc ${BISON_DATA_DIR}/xslt/xml2dot.xsl parser.xml > parser.dot -parser.tab.h: parser.y - bison ${DEBUG} -v -d parser.y +parser.svg: parser.dot + dot -Tsvg parser.dot > parser.svg calc: lex.yy.c parser.tab.c parser.tab.h - ${CC} lex.yy.c parser.tab.c -o calc + ${CC} ${CFLAGS} lex.yy.c parser.tab.c -o calc diff --git a/demo/bison/calc/parser.dot b/demo/bison/calc/parser.dot new file mode 100644 index 0000000..ac06822 --- /dev/null +++ b/demo/bison/calc/parser.dot @@ -0,0 +1,77 @@ +// Generated by GNU Bison 3.0.4. +// Report bugs to . +// Home page: . + +digraph "parser.y" +{ + node [fontname = courier, shape = box, colorscheme = paired6] + edge [fontname = courier] + + 0 [label="State 0\n\l 0 $accept: . input $end\l 1 input: . %empty [$end]\l 2 | . expr\l 3 expr: . NUMBER\l 4 | . '(' expr ')'\l 5 | . expr PLUS expr\l 6 | . expr MINUS expr\l 7 | . expr MULT expr\l 8 | . expr DIV expr\l"] + 0 -> 1 [style=solid label="NUMBER"] + 0 -> 2 [style=solid label="'('"] + 0 -> 3 [style=dashed label="input"] + 0 -> 4 [style=dashed label="expr"] + 0 -> "0R1" [style=solid] + "0R1" [label="R1", fillcolor=3, shape=diamond, style=filled] + 1 [label="State 1\n\l 3 expr: NUMBER .\l"] + 1 -> "1R3" [style=solid] + "1R3" [label="R3", fillcolor=3, shape=diamond, style=filled] + 2 [label="State 2\n\l 3 expr: . NUMBER\l 4 | . '(' expr ')'\l 4 | '(' . expr ')'\l 5 | . expr PLUS expr\l 6 | . expr MINUS expr\l 7 | . expr MULT expr\l 8 | . expr DIV expr\l"] + 2 -> 1 [style=solid label="NUMBER"] + 2 -> 2 [style=solid label="'('"] + 2 -> 5 [style=dashed label="expr"] + 3 [label="State 3\n\l 0 $accept: input . $end\l"] + 3 -> 6 [style=solid label="$end"] + 4 [label="State 4\n\l 2 input: expr . [$end]\l 5 expr: expr . PLUS expr\l 6 | expr . MINUS expr\l 7 | expr . MULT expr\l 8 | expr . DIV expr\l"] + 4 -> 7 [style=solid label="PLUS"] + 4 -> 8 [style=solid label="MINUS"] + 4 -> 9 [style=solid label="MULT"] + 4 -> 10 [style=solid label="DIV"] + 4 -> "4R2" [style=solid] + "4R2" [label="R2", fillcolor=3, shape=diamond, style=filled] + 5 [label="State 5\n\l 4 expr: '(' expr . ')'\l 5 | expr . PLUS expr\l 6 | expr . MINUS expr\l 7 | expr . MULT expr\l 8 | expr . DIV expr\l"] + 5 -> 7 [style=solid label="PLUS"] + 5 -> 8 [style=solid label="MINUS"] + 5 -> 9 [style=solid label="MULT"] + 5 -> 10 [style=solid label="DIV"] + 5 -> 11 [style=solid label="')'"] + 6 [label="State 6\n\l 0 $accept: input $end .\l"] + 6 -> "6R0" [style=solid] + "6R0" [label="Acc", fillcolor=1, shape=diamond, style=filled] + 7 [label="State 7\n\l 3 expr: . NUMBER\l 4 | . '(' expr ')'\l 5 | . expr PLUS expr\l 5 | expr PLUS . expr\l 6 | . expr MINUS expr\l 7 | . expr MULT expr\l 8 | . expr DIV expr\l"] + 7 -> 1 [style=solid label="NUMBER"] + 7 -> 2 [style=solid label="'('"] + 7 -> 12 [style=dashed label="expr"] + 8 [label="State 8\n\l 3 expr: . NUMBER\l 4 | . '(' expr ')'\l 5 | . expr PLUS expr\l 6 | . expr MINUS expr\l 6 | expr MINUS . expr\l 7 | . expr MULT expr\l 8 | . expr DIV expr\l"] + 8 -> 1 [style=solid label="NUMBER"] + 8 -> 2 [style=solid label="'('"] + 8 -> 13 [style=dashed label="expr"] + 9 [label="State 9\n\l 3 expr: . NUMBER\l 4 | . '(' expr ')'\l 5 | . expr PLUS expr\l 6 | . expr MINUS expr\l 7 | . expr MULT expr\l 7 | expr MULT . expr\l 8 | . expr DIV expr\l"] + 9 -> 1 [style=solid label="NUMBER"] + 9 -> 2 [style=solid label="'('"] + 9 -> 14 [style=dashed label="expr"] + 10 [label="State 10\n\l 3 expr: . NUMBER\l 4 | . '(' expr ')'\l 5 | . expr PLUS expr\l 6 | . expr MINUS expr\l 7 | . expr MULT expr\l 8 | . expr DIV expr\l 8 | expr DIV . expr\l"] + 10 -> 1 [style=solid label="NUMBER"] + 10 -> 2 [style=solid label="'('"] + 10 -> 15 [style=dashed label="expr"] + 11 [label="State 11\n\l 4 expr: '(' expr ')' .\l"] + 11 -> "11R4" [style=solid] + "11R4" [label="R4", fillcolor=3, shape=diamond, style=filled] + 12 [label="State 12\n\l 5 expr: expr . PLUS expr\l 5 | expr PLUS expr . [$end, PLUS, MINUS, ')']\l 6 | expr . MINUS expr\l 7 | expr . MULT expr\l 8 | expr . DIV expr\l"] + 12 -> 9 [style=solid label="MULT"] + 12 -> 10 [style=solid label="DIV"] + 12 -> "12R5" [style=solid] + "12R5" [label="R5", fillcolor=3, shape=diamond, style=filled] + 13 [label="State 13\n\l 5 expr: expr . PLUS expr\l 6 | expr . MINUS expr\l 6 | expr MINUS expr . [$end, PLUS, MINUS, ')']\l 7 | expr . MULT expr\l 8 | expr . DIV expr\l"] + 13 -> 9 [style=solid label="MULT"] + 13 -> 10 [style=solid label="DIV"] + 13 -> "13R6" [style=solid] + "13R6" [label="R6", fillcolor=3, shape=diamond, style=filled] + 14 [label="State 14\n\l 5 expr: expr . PLUS expr\l 6 | expr . MINUS expr\l 7 | expr . MULT expr\l 7 | expr MULT expr . [$end, PLUS, MINUS, MULT, DIV, ')']\l 8 | expr . DIV expr\l"] + 14 -> "14R7" [style=solid] + "14R7" [label="R7", fillcolor=3, shape=diamond, style=filled] + 15 [label="State 15\n\l 5 expr: expr . PLUS expr\l 6 | expr . MINUS expr\l 7 | expr . MULT expr\l 8 | expr . DIV expr\l 8 | expr DIV expr . [$end, PLUS, MINUS, MULT, DIV, ')']\l"] + 15 -> "15R8" [style=solid] + "15R8" [label="R8", fillcolor=3, shape=diamond, style=filled] +} diff --git a/demo/bison/calc/parser.html b/demo/bison/calc/parser.html new file mode 100644 index 0000000..724b703 --- /dev/null +++ b/demo/bison/calc/parser.html @@ -0,0 +1,334 @@ + + + + + + parser.y - GNU Bison XML Automaton Report + + +

GNU Bison XML Automaton Report

+ input grammar: parser.y

+ +

Table of Contents

Reductions

Nonterminals useless in grammar

+ +

Terminals unused in grammar

+ +

Rules useless in grammar

+

Conflicts

+ +

Grammar

+

+ 0 $accept → input $end + + 1 input → %empty + 2 | expr + + 3 expr → NUMBER + 4 | '(' expr ')' + 5 | expr PLUS expr + 6 | expr MINUS expr + 7 | expr MULT expr + 8 | expr DIV expr +

+ +

Terminals, with rules where they appear

+ +

$end (0) 0 +'(' (40) 4 +')' (41) 4 +error (256) +NUMBER (258) 3 +PLUS (259) 5 +MINUS (260) 6 +MULT (261) 7 +DIV (262) 8 +

+ +

Nonterminals, with rules where they appear

+ +

$accept (10) + on left: 0 +input (11) + on left: 1 2 + on right: 0 +expr (12) + on left: 3 4 5 6 7 8 + on right: 2 4 5 6 7 8 +

Automaton

+ +

state 0

+ +

0 $accept → . input $end + 1 input → . %empty [$end] + 2 | . expr + 3 expr → . NUMBER + 4 | . '(' expr ')' + 5 | . expr PLUS expr + 6 | . expr MINUS expr + 7 | . expr MULT expr + 8 | . expr DIV expr + + NUMBER shift, and go to state 1 + '(' shift, and go to state 2 + + $default reduce using rule 1 (input) + + input go to state 3 + expr go to state 4 +

+ +

state 1

+ +

3 expr → NUMBER . + + $default reduce using rule 3 (expr) +

+ +

state 2

+ +

3 expr → . NUMBER + 4 | . '(' expr ')' + 4 | '(' . expr ')' + 5 | . expr PLUS expr + 6 | . expr MINUS expr + 7 | . expr MULT expr + 8 | . expr DIV expr + + NUMBER shift, and go to state 1 + '(' shift, and go to state 2 + + expr go to state 5 +

+ +

state 3

+ +

0 $accept → input . $end + + $end shift, and go to state 6 +

+ +

state 4

+ +

2 input → expr . [$end] + 5 expr → expr . PLUS expr + 6 | expr . MINUS expr + 7 | expr . MULT expr + 8 | expr . DIV expr + + PLUS shift, and go to state 7 + MINUS shift, and go to state 8 + MULT shift, and go to state 9 + DIV shift, and go to state 10 + + $default reduce using rule 2 (input) +

+ +

state 5

+ +

4 expr → '(' expr . ')' + 5 | expr . PLUS expr + 6 | expr . MINUS expr + 7 | expr . MULT expr + 8 | expr . DIV expr + + PLUS shift, and go to state 7 + MINUS shift, and go to state 8 + MULT shift, and go to state 9 + DIV shift, and go to state 10 + ')' shift, and go to state 11 +

+ +

state 6

+ +

0 $accept → input $end . + + $default accept +

+ +

state 7

+ +

3 expr → . NUMBER + 4 | . '(' expr ')' + 5 | . expr PLUS expr + 5 | expr PLUS . expr + 6 | . expr MINUS expr + 7 | . expr MULT expr + 8 | . expr DIV expr + + NUMBER shift, and go to state 1 + '(' shift, and go to state 2 + + expr go to state 12 +

+ +

state 8

+ +

3 expr → . NUMBER + 4 | . '(' expr ')' + 5 | . expr PLUS expr + 6 | . expr MINUS expr + 6 | expr MINUS . expr + 7 | . expr MULT expr + 8 | . expr DIV expr + + NUMBER shift, and go to state 1 + '(' shift, and go to state 2 + + expr go to state 13 +

+ +

state 9

+ +

3 expr → . NUMBER + 4 | . '(' expr ')' + 5 | . expr PLUS expr + 6 | . expr MINUS expr + 7 | . expr MULT expr + 7 | expr MULT . expr + 8 | . expr DIV expr + + NUMBER shift, and go to state 1 + '(' shift, and go to state 2 + + expr go to state 14 +

+ +

state 10

+ +

3 expr → . NUMBER + 4 | . '(' expr ')' + 5 | . expr PLUS expr + 6 | . expr MINUS expr + 7 | . expr MULT expr + 8 | . expr DIV expr + 8 | expr DIV . expr + + NUMBER shift, and go to state 1 + '(' shift, and go to state 2 + + expr go to state 15 +

+ +

state 11

+ +

4 expr → '(' expr ')' . + + $default reduce using rule 4 (expr) +

+ +

state 12

+ +

5 expr → expr . PLUS expr + 5 | expr PLUS expr . [$end, PLUS, MINUS, ')'] + 6 | expr . MINUS expr + 7 | expr . MULT expr + 8 | expr . DIV expr + + MULT shift, and go to state 9 + DIV shift, and go to state 10 + + $default reduce using rule 5 (expr) + + Conflict between rule 5 and token PLUS resolved as reduce (%left PLUS). + Conflict between rule 5 and token MINUS resolved as reduce (%left MINUS). + Conflict between rule 5 and token MULT resolved as shift (PLUS < MULT). + Conflict between rule 5 and token DIV resolved as shift (PLUS < DIV). +

+ +

state 13

+ +

5 expr → expr . PLUS expr + 6 | expr . MINUS expr + 6 | expr MINUS expr . [$end, PLUS, MINUS, ')'] + 7 | expr . MULT expr + 8 | expr . DIV expr + + MULT shift, and go to state 9 + DIV shift, and go to state 10 + + $default reduce using rule 6 (expr) + + Conflict between rule 6 and token PLUS resolved as reduce (%left PLUS). + Conflict between rule 6 and token MINUS resolved as reduce (%left MINUS). + Conflict between rule 6 and token MULT resolved as shift (MINUS < MULT). + Conflict between rule 6 and token DIV resolved as shift (MINUS < DIV). +

+ +

state 14

+ +

5 expr → expr . PLUS expr + 6 | expr . MINUS expr + 7 | expr . MULT expr + 7 | expr MULT expr . [$end, PLUS, MINUS, MULT, DIV, ')'] + 8 | expr . DIV expr + + $default reduce using rule 7 (expr) + + Conflict between rule 7 and token PLUS resolved as reduce (PLUS < MULT). + Conflict between rule 7 and token MINUS resolved as reduce (MINUS < MULT). + Conflict between rule 7 and token MULT resolved as reduce (%left MULT). + Conflict between rule 7 and token DIV resolved as reduce (%left DIV). +

+ +

state 15

+ +

5 expr → expr . PLUS expr + 6 | expr . MINUS expr + 7 | expr . MULT expr + 8 | expr . DIV expr + 8 | expr DIV expr . [$end, PLUS, MINUS, MULT, DIV, ')'] + + $default reduce using rule 8 (expr) + + Conflict between rule 8 and token PLUS resolved as reduce (PLUS < DIV). + Conflict between rule 8 and token MINUS resolved as reduce (MINUS < DIV). + Conflict between rule 8 and token MULT resolved as reduce (%left MULT). + Conflict between rule 8 and token DIV resolved as reduce (%left DIV). +

+ + + diff --git a/demo/bison/calc/parser.svg b/demo/bison/calc/parser.svg new file mode 100644 index 0000000..67c6535 --- /dev/null +++ b/demo/bison/calc/parser.svg @@ -0,0 +1,459 @@ + + + + + + +parser.y + + +0 + +State 0 +  0 $accept: . input $end +  1 input: . %empty  [$end] +  2      | . expr +  3 expr: . NUMBER +  4     | . '(' expr ')' +  5     | . expr PLUS expr +  6     | . expr MINUS expr +  7     | . expr MULT expr +  8     | . expr DIV expr + + +1 + +State 1 +  3 expr: NUMBER . + + +0->1 + + +NUMBER + + +2 + +State 2 +  3 expr: . NUMBER +  4     | . '(' expr ')' +  4     | '(' . expr ')' +  5     | . expr PLUS expr +  6     | . expr MINUS expr +  7     | . expr MULT expr +  8     | . expr DIV expr + + +0->2 + + +'(' + + +3 + +State 3 +  0 $accept: input . $end + + +0->3 + + +input + + +4 + +State 4 +  2 input: expr .  [$end] +  5 expr: expr . PLUS expr +  6     | expr . MINUS expr +  7     | expr . MULT expr +  8     | expr . DIV expr + + +0->4 + + +expr + + +0R1 + +R1 + + +0->0R1 + + + + +1R3 + +R3 + + +1->1R3 + + + + +2->1 + + +NUMBER + + +2->2 + + +'(' + + +5 + +State 5 +  4 expr: '(' expr . ')' +  5     | expr . PLUS expr +  6     | expr . MINUS expr +  7     | expr . MULT expr +  8     | expr . DIV expr + + +2->5 + + +expr + + +6 + +State 6 +  0 $accept: input $end . + + +3->6 + + +$end + + +7 + +State 7 +  3 expr: . NUMBER +  4     | . '(' expr ')' +  5     | . expr PLUS expr +  5     | expr PLUS . expr +  6     | . expr MINUS expr +  7     | . expr MULT expr +  8     | . expr DIV expr + + +4->7 + + +PLUS + + +8 + +State 8 +  3 expr: . NUMBER +  4     | . '(' expr ')' +  5     | . expr PLUS expr +  6     | . expr MINUS expr +  6     | expr MINUS . expr +  7     | . expr MULT expr +  8     | . expr DIV expr + + +4->8 + + +MINUS + + +9 + +State 9 +  3 expr: . NUMBER +  4     | . '(' expr ')' +  5     | . expr PLUS expr +  6     | . expr MINUS expr +  7     | . expr MULT expr +  7     | expr MULT . expr +  8     | . expr DIV expr + + +4->9 + + +MULT + + +10 + +State 10 +  3 expr: . NUMBER +  4     | . '(' expr ')' +  5     | . expr PLUS expr +  6     | . expr MINUS expr +  7     | . expr MULT expr +  8     | . expr DIV expr +  8     | expr DIV . expr + + +4->10 + + +DIV + + +4R2 + +R2 + + +4->4R2 + + + + +5->7 + + +PLUS + + +5->8 + + +MINUS + + +5->9 + + +MULT + + +5->10 + + +DIV + + +11 + +State 11 +  4 expr: '(' expr ')' . + + +5->11 + + +')' + + +6R0 + +Acc + + +6->6R0 + + + + +7->1 + + +NUMBER + + +7->2 + + +'(' + + +12 + +State 12 +  5 expr: expr . PLUS expr +  5     | expr PLUS expr .  [$end, PLUS, MINUS, ')'] +  6     | expr . MINUS expr +  7     | expr . MULT expr +  8     | expr . DIV expr + + +7->12 + + +expr + + +8->1 + + +NUMBER + + +8->2 + + +'(' + + +13 + +State 13 +  5 expr: expr . PLUS expr +  6     | expr . MINUS expr +  6     | expr MINUS expr .  [$end, PLUS, MINUS, ')'] +  7     | expr . MULT expr +  8     | expr . DIV expr + + +8->13 + + +expr + + +9->1 + + +NUMBER + + +9->2 + + +'(' + + +14 + +State 14 +  5 expr: expr . PLUS expr +  6     | expr . MINUS expr +  7     | expr . MULT expr +  7     | expr MULT expr .  [$end, PLUS, MINUS, MULT, DIV, ')'] +  8     | expr . DIV expr + + +9->14 + + +expr + + +10->1 + + +NUMBER + + +10->2 + + +'(' + + +15 + +State 15 +  5 expr: expr . PLUS expr +  6     | expr . MINUS expr +  7     | expr . MULT expr +  8     | expr . DIV expr +  8     | expr DIV expr .  [$end, PLUS, MINUS, MULT, DIV, ')'] + + +10->15 + + +expr + + +11R4 + +R4 + + +11->11R4 + + + + +12->9 + + +MULT + + +12->10 + + +DIV + + +12R5 + +R5 + + +12->12R5 + + + + +13->9 + + +MULT + + +13->10 + + +DIV + + +13R6 + +R6 + + +13->13R6 + + + + +14R7 + +R7 + + +14->14R7 + + + + +15R8 + +R8 + + +15->15R8 + + + + + diff --git a/demo/bison/calc/parser.tab.c b/demo/bison/calc/parser.tab.c index 0948b48..2395da5 100644 --- a/demo/bison/calc/parser.tab.c +++ b/demo/bison/calc/parser.tab.c @@ -67,8 +67,9 @@ #include int yylex(); int yyerror(const char* error); +#define YYDEBUG 1 -#line 72 "parser.tab.c" /* yacc.c:339 */ +#line 73 "parser.tab.c" /* yacc.c:339 */ # ifndef YY_NULLPTR # if defined __cplusplus && 201103L <= __cplusplus @@ -92,7 +93,7 @@ int yyerror(const char* error); # define YY_YY_PARSER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG -# define YYDEBUG 1 +# define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; @@ -127,7 +128,7 @@ int yyparse (void); /* Copy the second part of user declarations. */ -#line 131 "parser.tab.c" /* yacc.c:358 */ +#line 132 "parser.tab.c" /* yacc.c:358 */ #ifdef short # undef short @@ -425,7 +426,7 @@ static const yytype_uint8 yytranslate[] = /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ static const yytype_uint8 yyrline[] = { - 0, 22, 22, 23, 26, 27, 28, 29, 30, 31 + 0, 23, 23, 24, 27, 28, 29, 30, 31, 32 }; #endif @@ -1196,49 +1197,49 @@ yyreduce: switch (yyn) { case 3: -#line 23 "parser.y" /* yacc.c:1646 */ +#line 24 "parser.y" /* yacc.c:1646 */ { printf("%f\n", (yyvsp[0])); } -#line 1202 "parser.tab.c" /* yacc.c:1646 */ +#line 1203 "parser.tab.c" /* yacc.c:1646 */ break; case 4: -#line 26 "parser.y" /* yacc.c:1646 */ +#line 27 "parser.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[0]); } -#line 1208 "parser.tab.c" /* yacc.c:1646 */ +#line 1209 "parser.tab.c" /* yacc.c:1646 */ break; case 5: -#line 27 "parser.y" /* yacc.c:1646 */ +#line 28 "parser.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-1]); } -#line 1214 "parser.tab.c" /* yacc.c:1646 */ +#line 1215 "parser.tab.c" /* yacc.c:1646 */ break; case 6: -#line 28 "parser.y" /* yacc.c:1646 */ +#line 29 "parser.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-2]) + (yyvsp[0]); } -#line 1220 "parser.tab.c" /* yacc.c:1646 */ +#line 1221 "parser.tab.c" /* yacc.c:1646 */ break; case 7: -#line 29 "parser.y" /* yacc.c:1646 */ +#line 30 "parser.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-2]) - (yyvsp[0]); } -#line 1226 "parser.tab.c" /* yacc.c:1646 */ +#line 1227 "parser.tab.c" /* yacc.c:1646 */ break; case 8: -#line 30 "parser.y" /* yacc.c:1646 */ +#line 31 "parser.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-2]) * (yyvsp[0]); } -#line 1232 "parser.tab.c" /* yacc.c:1646 */ +#line 1233 "parser.tab.c" /* yacc.c:1646 */ break; case 9: -#line 31 "parser.y" /* yacc.c:1646 */ +#line 32 "parser.y" /* yacc.c:1646 */ { (yyval) = (yyvsp[-2]) / (yyvsp[0]); } -#line 1238 "parser.tab.c" /* yacc.c:1646 */ +#line 1239 "parser.tab.c" /* yacc.c:1646 */ break; -#line 1242 "parser.tab.c" /* yacc.c:1646 */ +#line 1243 "parser.tab.c" /* yacc.c:1646 */ default: break; } /* User semantic actions sometimes alter yychar, and that requires @@ -1466,7 +1467,7 @@ yyreturn: #endif return yyresult; } -#line 33 "parser.y" /* yacc.c:1906 */ +#line 34 "parser.y" /* yacc.c:1906 */ int yyerror(const char* error) diff --git a/demo/bison/calc/parser.tab.h b/demo/bison/calc/parser.tab.h index f05a83f..0428297 100644 --- a/demo/bison/calc/parser.tab.h +++ b/demo/bison/calc/parser.tab.h @@ -34,7 +34,7 @@ # define YY_YY_PARSER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG -# define YYDEBUG 1 +# define YYDEBUG 0 #endif #if YYDEBUG extern int yydebug; diff --git a/demo/bison/calc/parser.y b/demo/bison/calc/parser.y index 098382a..98885e5 100644 --- a/demo/bison/calc/parser.y +++ b/demo/bison/calc/parser.y @@ -2,6 +2,7 @@ #include int yylex(); int yyerror(const char* error); +#define YYDEBUG 1 %} %start input -- cgit v1.3.1-23-gd82d