ANTLR 从 Java 到 C# [英] ANTLR from Java to C#

查看:24
本文介绍了ANTLR 从 Java 到 C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我计划创建一些可以自动从 Java 转换为 C# 的东西(然后反过来).我需要的是您可以用来将 Java 源代码转换为 C# 源代码的东西.

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.

我遇到了 ANTLR,但我不确定如何将它用于我的任务.我知道 ANTLR 对 Java 和 C# 都有强大的支持,并且已经有针对它们的现有语法,词法分析/解析过程,然后是 AST 创建,最后是树遍历器.从理论上讲,我明白了,但要真正让它发挥作用时,我却迟迟不肯干活.

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.

有人可以提供可用于任何语言的通用分步操作方法",因为我找不到任何关于如何使用 ANTLR 的体面教程?

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?

推荐答案

一旦您熟悉了 ANTLR 的基础知识,您将需要这些:openjdk.java.net/projects/compiler-grammar/antlrworks/Java.g +http://antlrcsharp.codeplex.com/

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/

这篇关于ANTLR 从 Java 到 C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆