3

我需要为 vbscript 编写一个翻译器到 c#。使用 ANTLR进行翻译的基本步骤是什么?我不太清楚是否使用语法(词法分析器/解析器?文件或字符串模板或 AST 或全部。建议?提前致谢。

4

3 回答 3

1

请参阅我可以对代码强制执行哪些类型的模式以使其更容易转换为另一种编程语言?

于 2011-02-12T00:43:48.683 回答
1

Is this really possible?

I'm "translating" (read: rewriting) a MS Access/VBA application since two years to C# and found out that even the online available converters (like this one which is more VB.NET, but anyway) fails at most basic conversions.

So my assumption until now is that there are way too much kind of constructs that are simply not translatable from VBScript to C#.

于 2011-01-17T05:32:07.347 回答
0

将 VBScript 转换为 C# 的最简单方法是使用 VB.NET 作为中间步骤。VBScript 与 VB.NET 非常相似(尽管存在一些差异),因此您只需将代码复制粘贴到 Visual Studio 中的新解决方案中即可。进行一些更改后,代码将能够编译。

您可以保留它(您可以从 C# 代码中调用生成的 DLL),但即使您不想这样做,将 VB.NET 转换为 C# 也是微不足道的。您甚至可以反编译生成的 DLL/EXE(尽管这会导致一些信息丢失)或使用任何在线 VB.NET 到 C# 转换器。

于 2015-02-12T18:47:13.133 回答