I get errors in calc.g, can someone walk me thru the steps to run any sample/ example ?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Mehul_Shah
Posted On:   Tuesday, July 10, 2001 12:44 PM

I am a new user and want to user this parser (ANTLR) to generate java code which can parse specific syntax. This is what I have done. 1. Downloaded and installed antlr-2.7.1 on SUN UNIX 2. I have Java 1.2.1 installed and working fine. 3. Set CLASSPATH so that where I installed this so one can access antlr.jar Now say I want to use one of the examples to understand steps I am doing these. 1. cd to antlr-2.7.1/examples/java/calc 2. java antlr.Tool calc.g this generates many files with .java extension. 3. Now I try to compile these files I get many errors. *** while doing javac Calc   More>>


I am a new user and want to user this parser (ANTLR) to generate java code which can parse specific syntax.
This is what I have done.


1. Downloaded and installed antlr-2.7.1 on SUN UNIX


2. I have Java 1.2.1 installed and working fine.


3. Set CLASSPATH so that where I installed this so one can access antlr.jar


Now say I want to use one of the examples to understand steps I am doing these.


1. cd to antlr-2.7.1/examples/java/calc


2. java antlr.Tool calc.g
this generates many files with .java extension.


3. Now I try to compile these files I get many errors.


*** while doing javac CalcLexer.java ...


CalcLexer.java:37: The method antlr.Token nextToken() declared in class CalcLexer cannot override the method of the same signature declared in class antlr.CharScanner. Their throws clauses are incompatible.
public Token nextToken() throws IOException {
^


*** While doing javac CalcParser.java...


CalcParser.java:35: Incompatible type for constructor. Explicit cast needed to convert antlr.Tokenizer to antlr.TokenStream.
super(lexer,k);
^


CalcParser.java:55: Exception antlr.TokenStreamException must be caught, or it must be declared in the throws clause of this method.
if ((LA(1)==PLUS)) {
^


CalcParser.java:59: Exception antlr.MismatchedTokenException must be caught, or it must be declared in the throws clause of this method.
match(PLUS);


........... And many more such errors.


Can someone help me showing exact steps for using ANTLR. OR if I am trying in correct what is wrong which creates errors in the sample/ examples.



Thanks,


Mehul.

   <<Less

Re: I get errors in calc.g, can someone walk me thru the steps to run any sample/ example ?

Posted By:   Terence_Parr  
Posted On:   Tuesday, July 10, 2001 09:54 PM

Do you have anything else in the path that might use ANTLR like BEA/Weblogic stuff?
About | Sitemap | Contact