I found a Java 1.5 grammar that has the capability of building ASTs in the
website. I tried test running it against a simple Java Hello world
program...and I get the following error......
line 2:0 mismatched input 'public' expecting LCURLY
<mismatched token: [...@0,2:7='public',<87>,2:0],
resync=publicclassTest{publicstaticvoidmain(String[]args){System.out.println("Helloworld...");}}>
>From what I see, it says it cant find a left curly brace after the public
keyword...but as a matter of fact, I did place that ...Can you please tell
me what could be the issue ?
BTW, here is my test case for that ...
package
a.b.c;
import
java.io.IOException;
import
org.antlr.runtime.*;
import
a.b.c.JavaTestParser.arrayInitializer_return;
public
class Test4 {
public static void main(String[] args) throws RecognitionException,
IOException {
// press F4 after highlighting charstream thingy CharStream charStream =
new ANTLRFileStream("C:/Test.java");
JavaTestLexer lexer =
new JavaTestLexer(charStream);
TokenStream tokenStream =
new CommonTokenStream(lexer);
JavaTestParser parser=
new JavaTestParser(tokenStream);
arrayInitializer_return tree=parser.arrayInitializer();
System.
out.println(""+tree.tree.toString());
System.
out.println("");
}
}
P.S: I was trying to play with this based on the tutorial that you showed me
the other day and its really interesting. I cant wait long to see the AST be
O/Ped...
-V
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en.