用于 PL/SQL 的 ANTLR 解析器,目标语言为 Java
我们有针对 Java 目标的 PL/SQL 语法吗?我得到了 C# 目标,但需要 Java 目标。
我想将其与 ANTLR 一起使用,以使用 StringTemplates 生成 Java。我已经阅读了文档并对如何实现这一目标有了很好的了解,只是想检查是否有人已经做过这种事情。
Do we have a PL/SQL grammer for Java target yet? I got the one for C#, but need for Java target.
I would like to use this with ANTLR to generate Java using StringTemplates. I've gone through the documentation and have a decent understanding of how to achieve this, just wanted to check if any one has already done this kind of thing.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,ANTLR 站点上有一个语法: http://antlr.org/grammar/1279318813752/ PLSQL.g
作者说它不解析SQL部分。
我不知道您希望仅阅读语法就能生成什么。你通常需要
远不止于此。请参阅我的答案,了解为什么不: antlr为 c 生成 ast 并解析 ast
编辑:OP 说他想将 PL/SQL 代码转换为 Java。请参阅我关于构建语言到语言翻译器所需的内容的答案:我可以在代码上强制执行哪些类型的模式,以便更轻松地转换为另一种编程语言?
Well, there's a grammar at the ANTLR site: http://antlr.org/grammar/1279318813752/PLSQL.g
The author says it doesn't parse the SQL part.
I don't know what you expect to be able to generate reading just the syntax. You usually need
much more than that. See my answer here as to why not: antlr generate ast for c and parse the ast
EDIT: OP says he wants to translate PL/SQL code to Java. See my answer on what it takes to build a language-to-language translator: What kinds of patterns could I enforce on the code to make it easier to translate to another programming language?