[antlr-interest] Grammar mismatch

Jim Idle jimi at temporal-wave.com
Thu Nov 26 12:02:44 PST 2009


You should not need to change the default debugging port, unless omsething else on your system is already using it, which it looks like it isn't.

Generally if the debugger never connects and the target of the debugger never stops, this means that you have an empty lexer rule:  XXX : ; by accident. Then you have to manually kill the debugging target's process.

Here, it also looks like you have generated the various components lexer->parser->treeparser out of sequence (the order you generate is important but look at the -make option or better still Maven).

Finally, check that what you are running is the correct version of your programs and not some old version in CLASSPATH somewhere.

Jim

> -----Original Message-----
> From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Konstantinos Kakousis
> Sent: Thursday, November 26, 2009 9:10 AM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] Grammar mismatch
> 
> 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(DebugEventSocke
> tProxy.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(DebugEventSocket
> Proxy.java:116)
> at
> org.antlr.runtime.debug.DebugEventSocketProxy.exitRule(DebugEventSocket
> Proxy.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(DBInputProc
> essorTree.java:199)
> at
> org.antlr.works.debugger.input.DBInputProcessorTree.processToken(DBInpu
> tProcessorTree.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,
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address





More information about the antlr-interest mailing list