用于解析规则的 C# 产品私有方法的 ANTLR
我正在尝试使用 ANTLR 使用 C# 代码生成为简单语言创建解析器。
我已经成功地生产了 MyLangLexer.cs 和 MyLangParser.cs,其中包含非常非常简单的规则,称为“规则”。
问题是生成的方法rule()是私有的。
我想要的只是使用 ANTLR 将字符串解析为 AST。
谢谢你, 我愿意。
I'm trying to use ANTLR to create a parser for simple language using C# code generation.
I have successfully product MyLangLexer.cs and MyLangParser.cs with very very simple rule called 'rule'.
The problem is that the generated method rule() is private.
All I want is to use ANTLR to parse a string into AST.
Thank you,
Ido.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
C# v3 目标默认生成私有方法,这与 Java 的目标相反。在您想要公开的规则前面添加关键字
public
:The C# v3 target produces private methods by default, in contrary to Java's target. Add the keyword
public
in front of those rules you want to be public: