[antlr-interest] Re: Java to C# translation

micheal_jor open.zone at virgin.net
Thu Nov 14 06:23:52 PST 2002


Hi Addi,

> I am new to ANTLR (in fact very new)..
> I am trying to convert a number of existing Java
> classes into C#, and after reading the ANTLR web site
> I am under the impression that:
> 
> This can be done, and in fact what Mr.  Michael J. has
> provided can do this.

ANTLR is a tool that can be used to auto-generate a lot of the code - 
lexers, parsers and treeparsers - required for building language 
translation tools such as the Java-to-C# translator you've described 
above but is not a Java-to-C# translator itself.

The ANTLR C# tool - antlr-2.7.2a2-CSharp.zip - on the website is a C# 
code generator for ANTLR - it enables ANTLR to generate lexers, 
parsers and treeparsers in C# (ANTLR already supports Java and C++ 
code generation). The tool is designed to work with the 2.7.2a2 
release of ANTLR only.

> So my questions are:
> 
> 1) Is it true to assume that given a .java file, I can
> convert that to C# (completely or partially) using
> antlr-2.7.2a2-CSharp.zip?

No.

Microsoft does have a tool called the JLCA that can do this but, it 
is an add-on to the VS.NET tool so you will need a copy of 
VisualStudio.NET before you can use it. It isn't perfect but you can 
find it at:

http://msdn.microsoft.com/vstudio/downloads/jca/

> P.S - Here are a few of the errors I am getting during
> the build per explanation given earlier...

These are errors with compiling ANTLR itself. I'm not very familiar 
with antlr-2.7.0 (and it is probably incompatible with the antlr-
2.7.2a2-CSharp.zip codegen in any case). I also wonder if the fact 
that you are using jdk1.4 is significant?

I'll advise downloading ANTLR-2.7.2a2 and trying again.

Cheers,

Micheal



 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list