ANTLR4 SQL Grammar from Apache Tajo project

833 views
Skip to first unread message

Kang Chen

unread,
Apr 26, 2014, 6:59:32 AM4/26/14
to antlr-di...@googlegroups.com
Hi Guys,
      
      > antlr4  SQLParser.g4 SQLLexer.g4
      > javac *.java
      > grun SQLParser sql -gui

      but it gives an error message:
      >java org.antlr.v4.runtime.misc.TestRig SQLParser sql -tokens
       Exception in thread "main" java.lang.ClassCastException: class SQLParser
                   at java.lang.Class.asSubclass(Class.java:3126)
                   at org.antlr.v4.runtime.misc.TestRig.process(TestRig.java:159)
                   at org.antlr.v4.runtime.misc.TestRig.main(TestRig.java:143)

     Any suggestions ?   antlr version is 4.2.1

Terence Parr

unread,
Apr 26, 2014, 9:41:36 AM4/26/14
to antlr-di...@googlegroups.com
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Kang Chen

unread,
Apr 26, 2014, 10:42:50 AM4/26/14
to antlr-di...@googlegroups.com
It seems not a classpath issue, I resolved it by :
  
change: 
      parser grammar SQLParser;

to :
grammar SQLParser;
import SQLLexer;

delete:
options {
language=Java;
tokenVocab=SQLLexer;
}

then: 
antlr4 SQLParser.g4
javac *java
grun SQLParser sql -gui

and it works
Reply all
Reply to author
Forward
0 new messages