g*********s 发帖数: 1782 | 1 用的bison。
google了一下,好像是在执行bison foo.y时加--debug选项,再在调用yyparse()之前
加上这两个语句:extern int yydebug; yydebug=1; 说是这样执行parser后就会有个
foo.output文件给出token parse的信息。
试了一下,不灵啊。还有说法要加--verbose选项,定义宏#define YYDEBUG 1等等,谁
知道到底怎么回事啊? |
k****e 发帖数: 100 | 2 编译的时候有一个 -t -d 什么的选项,看一下man吧
【在 g*********s 的大作中提到】 : 用的bison。 : google了一下,好像是在执行bison foo.y时加--debug选项,再在调用yyparse()之前 : 加上这两个语句:extern int yydebug; yydebug=1; 说是这样执行parser后就会有个 : foo.output文件给出token parse的信息。 : 试了一下,不灵啊。还有说法要加--verbose选项,定义宏#define YYDEBUG 1等等,谁 : 知道到底怎么回事啊?
|
g*********s 发帖数: 1782 | 3 上面这些零碎就是从manual里看来的啊。
【在 k****e 的大作中提到】 : 编译的时候有一个 -t -d 什么的选项,看一下man吧
|
t****t 发帖数: 6806 | 4 info bison
第8章 (debugging)
【在 g*********s 的大作中提到】 : 上面这些零碎就是从manual里看来的啊。
|
g*********s 发帖数: 1782 | 5 嘿嘿,牛人现身指点了。多谢多谢。
【在 t****t 的大作中提到】 : info bison : 第8章 (debugging)
|
r*********r 发帖数: 3195 | 6 i found the following article most useful in terms of de-mystifying yacc:
http://www.cs.uic.edu/~spopuri/cparser.html |
I**********s 发帖数: 441 | 7 http://www.cs.uic.edu/~spopuri/cparser.html is for bison, not yacc.
There is a new yacc/bison compatible LR(1) parser generator available:
http://compilers.iecc.com/comparch/article/08-02-019 |