[antlr-interest] Java to C# translation
Addi Jamshidi
ajpb at yahoo.com
Thu Nov 14 05:12:30 PST 2002
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.
If my assumption is correct I have the following
questions (what do I need to run for this to happen?):
1) I did download the antlr-2.7.2a2-CSharp.zip file.
And tried to follow the instructions for building it.
However I have been getting tons of errors (e.g.
classes not found, Load exception errors, etc.). The
doc says to run build.bat from the antlr top
directory. I have done that, in fact I have tried
running the build files from every directory there is,
and still I get the similar errors.
2) I then downloaded antlr-2.7.0.zip and installed it.
And then unzipped antlr-2.7.2a2-CSharp.zip for its
contained files to be copied in the directory tree
that antlr-2.7.0.zip created. Then I copied all the
build files into the antlr directory (i.e.
antlr-2.7.0\antlr directory), and then tried running
build.bat.
3) This time it did work better, however I am still
getting 33 errors during the build (some of which I
have included at the bottom of this email)...
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?
2) If so how can I use it (i.e. what do I need to run
for this to happen)?
Many thanks in advance,
Addi Jamshidi
P.S - Here are a few of the errors I am getting during
the build per explanation given earlier...
[loading
c:\j2sdk1.4.0\jre\lib\rt.jar(java/lang/IllegalAccessException.class)]
..\antlr\Tool.java:296: cannot resolve symbol
symbol : method getFormatter ()
location: interface antlr.FileLineFormatter
System.err.println(FileLineFormatter.getFormatter().
^
..\antlr\Tool.java:382: cannot resolve symbol
symbol : variable Version
location: class antlr.Tool
Version.project_version + "
1989-2002 jGuru.com");
^
..\antlr\Tool.java:383: cannot resolve symbol
symbol : variable Version
location: class antlr.Tool
version = Version.project_version;
^
..\antlr\Tool.java:410: cannot resolve symbol
symbol : class PreservingFileWriter
location: class antlr.Tool
return new PrintWriter(new
PreservingFileWriter(outputDir + System.getPr
operty("file.separator") + f));
^
[loading
c:\j2sdk1.4.0\jre\lib\rt.jar(java/lang/StringBuffer.class)]
..\antlr\Tool.java:571: cannot resolve symbol
symbol : method getFormatter ()
location: interface antlr.FileLineFormatter
System.err.println(FileLineFormatter.getFormatter().
^
..\antlr\Tool.java:584: cannot resolve symbol
symbol : method getFormatter ()
location: interface antlr.FileLineFormatter
System.err.println(FileLineFormatter.getFormatter().
^
..\antlr\Tool.java:587: cannot resolve symbol
symbol : method getFormatter ()
location: interface antlr.FileLineFormatter
System.err.println(FileLineFormatter.getFormatter().
^
..\antlr\Tool.java:600: cannot resolve symbol
symbol : variable StringUtils
location: class antlr.Tool
nameSpace = new
NameSpace(StringUtils.stripFrontBack(name, "\"", "\"
"));
^
[checking antlr.NameSpace]
[loading
c:\j2sdk1.4.0\jre\lib\rt.jar(java/util/AbstractList.class)]
[loading
c:\j2sdk1.4.0\jre\lib\rt.jar(java/util/AbstractCollection.class)]
[checking antlr.DefineGrammarSymbols]
..\antlr\DefineGrammarSymbols.java:20:
antlr.DefineGrammarSymbols should be decl
ared abstract; it does not define
beginSubRule(antlr.Token,int,boolean) in antlr
.DefineGrammarSymbols
public class DefineGrammarSymbols implements
ANTLRGrammarParseBehavior {
^
[loading ..\antlr\LexerGrammar.class]
[loading ..\antlr\TokenSymbol.class]
[loading ..\antlr\StringLiteralSymbol.class]
..\antlr\DefineGrammarSymbols.java:129: cannot resolve
symbol
symbol : method encodeLexerRuleName
(java.lang.String)
location: class antlr.CodeGenerator
id =
CodeGenerator.encodeLexerRuleName(id);
^
[loading ..\antlr\SimpleTokenManager.class]
[loading ..\antlr\ImportVocabTokenManager.class]
..\antlr\DefineGrammarSymbols.java:454: cannot resolve
symbol
symbol : variable StringUtils
location: class antlr.DefineGrammarSymbols
key =
StringUtils.stripFrontBack(name.getText(), "\"",
"\"");
^
..\antlr\DefineGrammarSymbols.java:497: cannot resolve
symbol
symbol : method encodeLexerRuleName
(java.lang.String)
location: class antlr.CodeGenerator
id =
CodeGenerator.encodeLexerRuleName(id);
^
[loading ..\antlr\GrammarElement.class]
..\antlr\DefineGrammarSymbols.java:565: cannot resolve
symbol
symbol : variable StringUtils
location: class antlr.DefineGrammarSymbols
language =
StringUtils.stripBack(StringUtils.stripFront(value.ge
tText(), '"'), '"');
^
..\antlr\DefineGrammarSymbols.java:565: cannot resolve
symbol
symbol : variable StringUtils
location: class antlr.DefineGrammarSymbols
language =
StringUtils.stripBack(StringUtils.stripFront(value.ge
tText(), '"'), '"');
^
..\antlr\DefineGrammarSymbols.java:576: cannot resolve
symbol
symbol : variable StringUtils
location: class antlr.DefineGrammarSymbols
tool.literalsPrefix =
StringUtils.stripFrontBack(value.getText()
, "\"", "\"");
^
[loading ..\antlr\ParserGrammar.class]
[loading ..\antlr\TreeWalkerGrammar.class]
[checking antlr.Grammar]
[loading ..\antlr\RuleBlock.class]
[loading ..\antlr\AlternativeBlock.class]
[loading ..\antlr\AlternativeElement.class]
__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list