In This Article

LL Parser Debugger

The LL Parser Debugger allows you to load an assembly which contains a non-abstract ILLParser implementation class and debug the grammar.

Opening the LL Parser Debugger pane shows a new Debugger contextual tab on the ribbon.

Debugger Layout

The debugger comes with a number of panels that contain useful information about your grammar. Some of them are only used when stepping through the process of parsing the example text.

Screenshot

The LL Parser Debugger

EBNF Rules Pane

The main part of the debugger window is taken up by the EBNF representation of your grammar. Each production that you defined in your grammar class should show up in this window, expressed in standard EBNF notation.

If you find that you are having trouble with one of your productions, this window is a good place to look to see if the production is being interpreted as you expected.

Input Tab

At the bottom of the debugger pane, there is an Input tab. This tab is populated with the example code from the Language Project that Language Designer currently has loaded.

The text entered in this tab is used as input for the parser for debugging.

You can edit the text in this input if you want to test something specific, but changes to the contents of this box are not preserved for future debugging sessions.

Parse Errors Tab

The Parse Errors tab will report any parsing errors encountered while debugging.

If an error is reported while debugging, either the example input text is incorrectly formed, or the grammar is not correct.

Terminals Tab

The Terminals tab reports all the terminals that are defined in the Grammar.

Non-Terminal Stack Tab

The Non-Terminal Stack tool reports the stack from the parser, as you are single-stepping through a parse operation.

Matches Tab

The Matches tool reports the matched results from each production as you are stepping through a parse operation. This can be very helpful in debugging a grammar as you can see the immediate results from a specific production as it completes.

Conditions Tab

The Conditions tool lists all the possible next tokens that are valid for the current production. This information is used to determine whether the parser can attempt a match within a production by comparing the list with the look-ahead token.

Opening a Parser

Clicking the Open Parser button launches a file browser dialog. Navigate to and select an assembly that contains a non-abstract ILLParser implementation. Note that the parser implementation class must have a parameterless constructor.

If there are two or more non-abstract ILLParser implementations in the same assembly, the LL Parser Debugger will prompt and ask which parser it should load.

There are a number of grammar-related exceptions that can occur when loading an assembly for debugging. The exception message should be helpful in solving the issue that is causing the exception, and the issue(s) must be resolved before the debugger can load the parser and debug the grammar.

Once the parser is loaded, you should see the main area of the debugger populated with EBNF rules that represent your grammar. This will be described in further detail below.

Debugging

Screenshot

The LL Parser Debugger controls

If you would like to see the complete results of parsing the example text without stepping through, you can simply click the Start button. The Parse Errors tab will populate with any error messages generated. The Matches tool will populate with the AST result of the parsing operation.

If there is an issue in the complete parse tree that you would like to debug, it can be very informative to step through the grammar. You can begin this by pressing the Step Into button instead of the Start button. Each time you click Step Into, you will drill deeper into the production rules, following the parser's path. If you want to skip over a production rule that you are not interested in, you can click Step Over. Or, if you would like to leave a production rule that you no longer need additional information about, you can click Step Out, and the debugger will continue from the next element of the parent production.

If you know the exact production you would like to debug, you can place a breakpoint on that production by clicking within the production and clicking the Toggle Breakpoint button. You can then press Start and the debugger will run until it hits that breakpoint.

You can stop the debugger at any time by clicking the Stop button.

If you would like to see the next term that the debugger will evaluate, click the Show Next Term button. The next term is usually in view already by default, but if you scrolled the view away from that location, the Show Next Term button provides a convenient way to relocate the debugger's position in the grammar.

Hotkeys

The** LL Parser Debugger** supports the same main debugging hotkeys as Visual Studio.

Hotkey Combination Action
F5 Start Debugging
Shift+F5 Stop Debugging
F11 Step Into
F10 Step Over
Shift+F11 Step Out
F9 Toggle Breakpoint