diff options
| Commit | d57561ef43c80fa6050e80f4876a45ba886818ff (patch) | |
|---|---|---|
| Author | 2018-10-21 21:29:04 +0300 | |
| Committer | 2018-10-21 21:29:31 +0300 | |
| Files | c2d4726a7b8093cafb03853943c4752fa643fa2b | |
| IPL-d57561ef43c80fa6050e80f4876a45ba886818ff.tar IPL-d57561ef43c80fa6050e80f4876a45ba886818ff.tar.gz IPL-d57561ef43c80fa6050e80f4876a45ba886818ff.zip | ||
| Parent | 1384d7ea4e80eaa6b195195af81de974575b2bb0 (diff) | |
Debugging options for the bison parser
4 files changed, 12 insertions, 4 deletions
| -rw-r--r-- | demo/bison/calc/Makefile | 4 | ||||
| -rw-r--r-- | demo/bison/calc/parser.tab.c | 6 | ||||
| -rw-r--r-- | demo/bison/calc/parser.tab.h | 2 | ||||
| -rw-r--r-- | demo/bison/calc/parser.y | 4 |
diff --git a/demo/bison/calc/Makefile b/demo/bison/calc/Makefile index 1fb7554..ba07ca1 100644 --- a/demo/bison/calc/Makefile +++ b/demo/bison/calc/Makefile @@ -4,10 +4,10 @@ lex.yy.c: lexer.lex flex lexer.lex parser.tab.c: parser.y - bison -v -d parser.y + bison ${DEBUG} -v -d parser.y parser.tab.h: parser.y - bison -v -d parser.y + bison ${DEBUG} -v -d parser.y calc: lex.yy.c parser.tab.c parser.tab.h ${CC} lex.yy.c parser.tab.c -o calc diff --git a/demo/bison/calc/parser.tab.c b/demo/bison/calc/parser.tab.c index 11422b8..0948b48 100644 --- a/demo/bison/calc/parser.tab.c +++ b/demo/bison/calc/parser.tab.c @@ -92,7 +92,7 @@ int yyerror(const char* error); # define YY_YY_PARSER_TAB_H_INCLUDED /* Debug traces. */ #ifndef YYDEBUG -# define YYDEBUG 0 +# define YYDEBUG 1 #endif #if YYDEBUG extern int yydebug; @@ -1478,6 +1478,10 @@ int yyerror(const char* error) int main() { +#if YYDEBUG + yydebug = 1; +#endif + yyparse(); return 0; } diff --git a/demo/bison/calc/parser.tab.h b/demo/bison/calc/parser.tab.h index 0428297..f05a83f 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 0 +# define YYDEBUG 1 #endif #if YYDEBUG extern int yydebug; diff --git a/demo/bison/calc/parser.y b/demo/bison/calc/parser.y index 7a9aefb..098382a 100644 --- a/demo/bison/calc/parser.y +++ b/demo/bison/calc/parser.y @@ -41,6 +41,10 @@ int yyerror(const char* error) int main() { +#if YYDEBUG + yydebug = 1; +#endif + yyparse(); return 0; } |
