[antlr-interest] Grammar mismatch

Konstantinos Kakousis csp7kk3 at cs.ucy.ac.cy
Thu Nov 26 09:10:21 PST 2009


Hello,

First of all let me thank you for providing such a great tool.
Now to the reason I’m posting here: After reading “The Definite ANTLR 
Reference” I have managed to create my DSL grammar.
I use anltrworks 1.3.1 and everything works fine as long as no ASTs are 
involved.
Just to be sure that there is nothing wrong with my grammar, the same 
problem occurs with the simple example of: Expr.g and Eval.g,
found in the book.( I just copy-pasted the code from the web).

After compiling successfully both, grammar and tree grammar when I 
attempt to run or debug the tree grammar (parser grammar run and debugs ok)
I get:
1) Grammar Mismatch popup: Warning the grammar used by the remote parser 
is not the same (Expr.g)
2) In output tabt :

(+ 4 5) java.net.SocketException: Unrecognized Windows Sockets error: 0: 
JVM_Bind java.net.SocketException: Unrecognized Windows Sockets error: 
0: JVM_Bind at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at java.net.ServerSocket.<init>(Unknown Source)
at 
org.antlr.runtime.debug.DebugEventSocketProxy.handshake(DebugEventSocketProxy.java:75)
at Eval.<init>(Eval.java:49)
at Eval.<init>(Eval.java:41)
at __Test__.main(__Test__.java:19)
Exception in thread "main" java.lang.NullPointerException
at 
org.antlr.runtime.debug.DebugEventSocketProxy.transmit(DebugEventSocketProxy.java:116)
at 
org.antlr.runtime.debug.DebugEventSocketProxy.exitRule(DebugEventSocketProxy.java:130)
at Eval.prog(Eval.java:149)
at __Test__.main(__Test__.java:21)

3) Consol reports a huge amount of exceptions starting with:
[18:56:42] java.lang.ClassCastException: 
org.antlr.runtime.debug.RemoteDebugEventSocketListener$ProxyToken cannot 
be cast to org.antlr.works.debugger.tree.DBTreeToken
at 
org.antlr.works.debugger.input.DBInputProcessorTree.getNode(DBInputProcessorTree.java:199)
at 
org.antlr.works.debugger.input.DBInputProcessorTree.processToken(DBInputProcessorTree.java:14
.....

I have managed to avoid this behavior a couple of times by restarting 
antlrworks, rebooting etc. but now it insists not to work even for the 
simplest grammar.
I also tried unsuccessfully to change debugger port, I googled the 
problem but I didn’t find anything similar, obviously I’m missing 
something out here.
Any ideas? Is it something really simple or is it the first time that 
this is reported.

Thanks for your time!
BR,



More information about the antlr-interest mailing list