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?

有帮助吗?

解决方案

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/

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top