javacc parseException...前瞻问题?
我正在为 javacc 中的一个非常简单的语法编写一个解析器。 它开始融合在一起,但此刻我完全陷入了这个错误:
ParseException: Encountered "" at line 4, column 15.
Was expecting one of:
有问题的输入行是 z = y + z + 5 ,
而给我带来问题的产生式是我的表达式哪个被调用 varDecl():
<ID> <EQL> expression()
表达式如下所示:
<VAR> (<PLUS> expression())?| <NUM> (<PLUS> expression())?
| call() (<PLUS> expression())?
我不知道为什么会收到此错误 - 任何见解将不胜感激。
I'm writing a parser for a very simple grammar in javacc. It's beginning to come together but at the moment I'm completely stuck on this error:
ParseException: Encountered "" at line 4, column 15.
Was expecting one of:
The line of input in question is z = y + z + 5
and the production that is giving me problems is my expression which get called from
varDecl():
<ID> <EQL> expression()
Expression looks like this:
<VAR> (<PLUS> expression())?| <NUM> (<PLUS> expression())?
| call() (<PLUS> expression())?
I'm at a loss as to why I'm getting this error - any insight would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,是的,这不是 JavaCC 的一个非常有用的错误。 您使用什么版本的 JavaCC?
另外,在没有看到完整语法的情况下很难解决这些问题......尽管我知道您可能无法发布该内容。
Hm, yes, that's not a very helpful error from JavaCC. What version of JavaCC are you using?
Also, it's difficult to troubleshoot these problems without seeing the full grammar... and although I understand you might not be in a position to post that.