D 中的 gppg/gplex 等效吗?
当我在 C# 中工作时,我发现了 gppg 和 gplex 解析器/词法分析器生成器非常适合我的需求。我想知道 D 编程语言是否有类似的东西(即,给定 BNF 或 EBNF 语法的实用程序,输出将该语言词法/解析为抽象语法树的 D 代码)。
我发现的最接近的是 Goldie,但我很难理解它,所以我'我无法启动并运行任何东西。
When I was working in C#, I found the gppg and gplex parser/lexer generators to be perfect for my needs. I'm wondering if there's something similar for the D programming language (i.e. a utility that, given a grammar in BNF or EBNF, outputs D code that lexes/parses that language into a abstract syntax tree).
The closest I've found is Goldie, but I'm having so much trouble understanding it that I'm not able to get anything up and running.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我发现 Goldie 对于上下文不敏感语法非常出色,你确定吗?另外,http://www.wikiservice.at/d/wiki.cgi?GrammarParsers 列出了一些,不知道哪些仍在开发中。如果 ANTLR-D 仍然有效,它可能是最好的选择之一。
I have found Goldie pretty awesome for context-insensitive grammars, are you sure about it? Also, http://www.wikiservice.at/d/wiki.cgi?GrammarParsers lists some, no idea which are still developed. If ANTLR-D still works, it is probably on of the best choices.
Goldie 可能是您最好的选择,但还有可以发出 D 的 ragel。这并不完全是您所要求的(可组合状态机),尽管它可能足以满足许多情况并且非常好。
Trunk 版本可以使用未记录的 -E 开关编译为 D2 代码,我还不确定它有多成熟。
http://www.complang.org/ragel/
Goldie is probably your best bet, but there's also ragel which can emit D. It's not exactly what you asked for (composable state machines) though it might suffice for many cases and it's really nice.
Trunk version can compile to D2 code with the undocumented -E switch, I'm not sure yet how mature that is.
http://www.complang.org/ragel/