简体   繁体   English

用于PL / SQL的ANTLR解析器,目标语言为Java

[英]ANTLR parser for PL/SQL with target language as Java

Do we have a PL/SQL grammer for Java target yet? 我们是否有针对Java目标的PL / SQL语法? I got the one for C#, but need for Java target. 我得到了一个C#,但需要Java目标。

I would like to use this with ANTLR to generate Java using StringTemplates. 我想在ANTLR中使用它来使用StringTemplates生成Java。 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. 我已经阅读了文档并对如何实现这一点有了一个很好的理解,只是想检查是否有人已经做过这种事情。

Well, there's a grammar at the ANTLR site: http://antlr.org/grammar/1279318813752/PLSQL.g 那么,在ANTLR网站上有一个语法: http//antlr.org/grammar/1279318813752/PLSQL.g

The author says it doesn't parse the SQL part. 作者说它不解析SQL部分。

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 在这里看到我的答案为什么不: antlr为c生成ast并解析ast

EDIT: OP says he wants to translate PL/SQL code to Java. 编辑:OP说他想将PL / SQL代码翻译成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? 请参阅我的答案,了解如何构建语言到语言的翻译器: 我可以对代码强制执行哪些模式,以便更容易翻译成另一种编程语言?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM