How to build antlr 4.5 optimized

235 views
Skip to first unread message

peter....@openfokus.org

unread,
Nov 26, 2015, 3:40:35 PM11/26/15
to antlr-discussion
 I would like to use the Java8.g4 grammar and according to http://stackoverflow.com/questions/32910013/antlr-v4-java8-grammar-outofmemoryexception

I should use the inofficial optimized branch.

I build it and get:

dev% antlr4 -visitor -package java8 Java8.g4
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/runtime/tree/CommonTree
    at java.lang.ClassLoader.defineClass1(Native Method)
...


What are the dependencies / what must be on the classpath ?

I got the following jars from the build:

antlr4-maven-plugin/target/antlr4-maven-plugin-4.5.jar
runtime/JavaAnnotations/target/antlr4-annotations-4.5.jar
runtime/Java/lib/org.abego.treelayout.core.jar
runtime/Java/target/antlr4-runtime-4.5.jar
tool/target/antlr4-4.5.jar
tool/target/antlr4-4.5-tests.jar


Thanks
Peter

peter....@openfokus.org

unread,
Nov 26, 2015, 6:00:51 PM11/26/15
to antlr-discussion
Answering my post:

I had to add antlr-runtime-3.5.2.jar and ST4-4.0.8.jar to the classpath.

@Sam: concerning the reply you gave to the question on the mentioned stackoverflow page, your code contains the comment :

  // TODO: reset your input stream

Do I correctly understand that if the parser fails in the try clause, we have to restart from the beginning of the document ?
Also I noticed that only very small documents will stay in the try clause and slightly more complicated - but correct - input ( 100 LOC )
will cause a ParserCancellationError. Is this the intended behavior ?

Thanks
Peter
Reply all
Reply to author
Forward
0 new messages