cmake时无报错,但是运行时单独输出“syntax error”而无其他信息 #93
Unanswered
RegiaYoung
asked this question in
Q&A
Replies: 1 comment 4 replies
-
可以自己 gdb 调试,或者给出更多信息 |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
大概上面这种情况,冒个语法错误,但树正常构建,json也一致,但我检查找不到出错的位置,感觉没有问题,因为我们的yyerror不太容易改动,也不太熟悉Bison,现在是解决不了。
GPT: Yes, there is a way to output detailed error messages when running a binary program compiled by Bison. The Bison parser expects to report the error by calling an error reporting function named yyerror, which you must supply. It is called by yyparse whenever a syntax error is found, and it receives one argument. For a syntax error, the string is normally “syntax error”. You can implement this function to output detailed error messages that can help you debug your program. You can also use the -v option when running Bison to generate a verbose output file that contains detailed information about the parser’s automaton computed by Bison1. Another option is to use the -Werror option when compiling your program with GCC. This option treats all warnings as errors and causes GCC to stop compiling if any warnings are generated2. I hope this helps!
Beta Was this translation helpful? Give feedback.
All reactions