Skip to content

Viewing a live preview of parse tree

Zev Spitz edited this page Oct 31, 2019 · 4 revisions

Seeing how the RD parser understands a piece of code can be helpful in contributing to the rubberduck, especially when creating inspections, quickfixes or implementing a new command that deals with reading or modifying the VBA source code. It is possible to view the resulting parse tree via the Locals or Watch windows, but going through the nodes can be tedious and does not give you a high-level picture.

For that, we recommend using the ANTLR 4 Visualizer which is a Visual Studio debug visualizer and can be used in a debug session. Refer to its Installing section for instructions on how to install it and Usage section for using it.

Screenshot of ANTLR4 Visualizer

It allows you to choose a string, token stream, or parse tree; select (where appropriate) the lexer, parser and parser method; and shows you the list of tokens and the parse tree.

Beginning with a string, and selecting a lexer, parser and parse method

Clone this wiki locally