使用flex和bison的问题
有人研究过 Flex 和 Bison 吗?
我有一个例子。我运行它,但它显示没有野牛,
例如:在 .l 文件的 Flex 中,我定义了 id 并为其放置 printf{"id"} 。
在野牛中,我定义了这样的内容:
id_list : ID {printf("id-list::=id\n");}
| id_list ',' ID {printf("id-list::=<id-list>,id\n");}
但是当我输入 id 时运行 main.exe 时,它只显示 id(不应该打印 id-list::=id 吗???) 我知道我解释得不好,如果我遗漏了什么,请告诉我或让我输入代码。
did anybody worked on flex and bison??
i have an example of them.i run it but it shows without bison,
for example: in flex in .l file i defined id and put printf{"id"} for it.
and in bison i defined something like this:
id_list : ID {printf("id-list::=id\n");}
| id_list ',' ID {printf("id-list::=<id-list>,id\n");}
but when i run main.exe when i entered id it just show id(shouldnt it print id-list::=id????)
i know i didnt explain well,if im missing something please say me or say me to put codes.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有一些事情可能是错误的。第一个错误是printf。 Printf 缺少 %s,因此它只会打印您的文本。这是我
C 文件中执行此操作的方法
在lex 文件中的
Theres a few things that could be wrong. First which is wrong is the printf. Printf is missing %s so it will only print your text. Heres how i'd do it
in your C file
in the lex file