[antlr-interest] (newbie problem) rewrite rule question

Randall R Schulz rschulz at sonic.net
Tue Jul 10 18:26:43 PDT 2007


On Tuesday 10 July 2007 18:07, ali azimi wrote:
> Hi,
>
>   Yes. It would be fantastic if I could make the debugger in my
> ANTLRWorks work. I have tried but still can not use the debugger. I
> remember when I used to try to use the debugger; my ANTLRWorks would
> produce the following error message:
>
>   Connection Error:
>   Cannot launch the debugger.
>   Time-out waiting to connect to the remote parser.

I've found that the best way to use the ANTLRWorks debugger is remotely. 
The reason is that this frees you from all the classpath and JVM 
compatibility issues of direct debugging. This may be a consequence of 
my situation, having a parser that is intimately tied to a large 
software system with several of its own packages and many external 
(JAR, typically) dependencies.

So all you need to do to make this work is generate your parser using 
ANTLR's "-debug" option. Then launch your test jig, passing it whatever 
arguments it requires, if any, to run a test. It will pause (or appear 
to hang). It's waiting for a connection from the debugger. Now switch 
to ANTLWorks and select the "Debug Remote..." command from the "Debug" 
menu. The default host ("localhost") and port (49153) will work.

Now you can single step, look at the stack of rule invocations, see the 
parse tree or AST (if any) and generally turn your parser / grammar 
inside out.


Have at it!


Randall Schulz


More information about the antlr-interest mailing list