ANTLR from Java to C#

无人久伴 提交于 2019-12-13 02:13:43

问题


I'm planning to create something that would do automated translation from Java to C# (and in reverse afterwards). What I need is something that you could use to translate Java source code into C# source code.

I ran across ANTLR, but I'm not exactly sure of how go about using it for my task. I know ANTLR has a strong support for both Java and C#, and there are already existing grammars for both of them, the lexing/parsing process, then the AST creation, and then finally the tree walker. Theoretically, I get it, but when it comes to actually putting it to work, I stall hardcore.

Can someone provide a generic step-by-step of "how to" that can be used for any language, because I can't find any decent tutorials of how to even use ANTLR?


回答1:


Once you made yourself familiar with the basics of ANTLR you will need these: openjdk.java.net/projects/compiler-grammar/antlrworks/Java.g + http://antlrcsharp.codeplex.com/



来源:https://stackoverflow.com/questions/9069592/antlr-from-java-to-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!