ANTLR4: debug / trace lexer

How can I debug / trace / unload the paths that the lexer created by ANTLR4 chooses? Many times I was not lucky to see in the grammar itself what went wrong.

+4
source share
1 answer

You can use ANTLRWorks . In run -> Interpret lexer you can see the result for the lexer grammar. You may also click Window → Lexer Debugger Controller Window if it does not automatically display. Under it you can see types, tokens, channels, modes, lookahead. Tokens are very useful to see which "string" was recognized as a token. Also, if I have lexer modes, I always use antlrworks.

enter image description here

enter image description here

+4
source

All Articles