In order to debug a tree grammar the input must be an AST.
Presently the only way to gain access to AST input is through creating a parser that provides "remote debugging".
See How do I set up remote debugging anyway?.
It is necessary to first build an AST that will serve as input to the tree grammar parser.
This parser (sample.g) will not be a debug parser and must not be generated with the -debug option. Only the tree grammar (sampleWalker.g) source should be generated with the -debug option
This program blocks when
is executed, waiting for a remote process to connect. From within ANTLRWorks open sampleWalker.g and select "Debugger -> Debug Remote", using the default host and port, localhost:49153. This allows ANTLRWorks to take control of the remote parsing operation.