LL Parser Visualization

 

Download

You can download our project from the link below. Please unzip the file and run LLParserViz.jar inside the folder.

LLParserViz.zip

 

Source and Project files :

                              I.            You can download the project source code here.

                           II.            If you use Netbeans IDE to develop your JAVA projects we also have a Netbeans project file. You can download them here.

Note :

1.      This Visualization requires JAVA Version 1.6.

2.      There is a document that contains instruction and references on how to run the project. You could either download the link or read it on the site.

3.      Reading all the instructions is not necessary. You can use the instructions more like a reference. The software is quite intuitive and has sufficient visual feedback for every step.

 

 

Documentation

 

We have split the instructions based on the screens.

 

First Set Construction

This screen demonstrates the construction of First Set. The screen contains the following panes:

  1. Grammar pane: This pane displays the grammar and highlights the currently considered production along with the currently considered symbol in the production.
  2. First Set pane: This pane displays the first set of each non terminal in the current state.
  3. Explanation pane: This pane displays an explanation of all the steps from the beginning to the current state.

The screen provides the following controls:

  1. Next button: This button allows the user to progress to the next state in first set construction
  2. Previous button: This button allows the user to progress to the previous state in first set construction
  3. Beginning button: This button enables the user to restart the first set construction from the beginning
  4. End button: This button enables the user to move to the last state in first set construction and view the state of the completed first table
  5. SkipCycle button: This button enables the user to skip the current cycle and move to the beginning of the next cycle. A cycle is defined as an iteration through the list of productions

Follow Set Construction

This screen demonstrates the construction of Follow Set construction. The screen contains the following panes:

  1. Grammar pane: This pane displays the grammar and highlights the currently considered production along with the currently considered symbol in the production.
  2. First Set pane: This pane displays the first set of each non terminal. The first set of each non terminal is obtained from the First Set Construction phase.
  3. Follow Set pane: This pane displays the follow set of each non terminal in the current state.
  4. Explanation pane: This pane displays an explanation of all the steps from the beginning to the current state.

The screen provides the following controls:

  1. Next button: This button allows the user to progress to the next state in follow set construction
  2. Previous button: This button allows the user to progress to the previous state in follow set construction
  3. End button: This button enables the user to move to the last state in follow set construction and view the state of the completed follow table
  4. Beginning button: This button enables the user to restart the follow set construction from the beginning

Parsing Table Construction

This phase provides two modes to aid the understanding of parsing table construction.

  1. Step Mode: In this mode the user can sequentially step through the various steps involved in constructing the parsing table. The user can step forward or backward at any stage. Shortcuts are provided to move to the first or the last state in this phase.
  2. Examination mode: Once the user is comfortable with the steps performed in the parsing table construction phase, she could switch to Examination mode. In this mode the entire parsing table is completed. The user can click on any production and observe which terminals came into play with regard to this production and also look at which cells in the parsing table were filled in due to this production.

The parsing table construction panel consists of the following panes:

  1. Grammar pane: This pane displays all the productions in the grammar. While stepping through the table construction this phase highlights the currently considered production. While examining the table, this table displays clickable productions.
  2. First and Follow pane: This pane displays two tables. The first table displays the first of the right hand sides of the productions. The second table displays the follow and first of the non terminals in the grammar.
  3. Parsing table pane: This pane displays the current state of the parsing table.
  4. Explanation pane: In the step mode, this pane provides an explanation of all the steps executed to arrive at the current state of the parsing table. In the examination mode, this pane explains how the currently chosen production affects the parsing table.

The parsing table construction panel provides the following controls:

  1. Beginning button: Moves to the first state in the parsing table construction phase
  2. End button: Moves to the last state in the parsing table construction phase
  3. Next button: Moves to the next state in the parsing table construction phase. This button is enabled only in step mode.
  4. Previous button: Moves to the previous state in the parsing table construction phase. This button is only enabled in the step mode
  5. Examine Parsing Table button: This button transitions the parsing table construction phase from Step Mode to Examination Mode. On clicking this button the text on the button changes to [Return To Step Mode]. When the text reads [Return To Step Mode], clicking the button transitions back to Step Mode.
  6. Grammar pane: In Examination Mode, the productions in the Grammar pane are clickable. Clicking a production displays the cells in the parsing table that are filled in as a result of the chosen production and the symbols in the First and Follow pane considered to fill the cells.

Input String Parser

This screen demonstrates the parsing of the input string. The screen contains the following panes:

  1. Grammar pane: This pane displays the grammar.
  2. Explanation pane: This pane maintains an explanation of all the steps that occurred from the beginning of the phase to the current state.
  3. Parsing Table pane: This pane displays the parsing table constructed during the Parsing Table Construction Phase. While parsing the input string, this pane highlights the currently considered cell in the parsing table (cell corresponding to the current non-terminal in the stack and the current terminal in the input string)
  4. Input String Parsing Window: Displays the contents of the stack and the input string in the current state. This pane highlights the top (element) of the stack and the leftmost element in the string (which is the current element in the string being parsed)
  5. Input text box: The input to be parsed must be entered in this box

The screen provides the following controls:

  1. Next button: This button allows the user to progress to the next state in input string parsing
  2. Previous button: This button allows the user to progress to the previous state in input string parsing
  3. End button: This button enables the user to move to the last state in input string parsing (the input string and the stack would contain only the end markers which marks the successful parsing of the input string)
  4. Beginning button: This button enables the user to restart the input string parsing from the beginning
  5. Submit button: Once the input is entered in the input string text box, clicking the Submit Input button loads the new input and moves to the first state of input string parsing for the new input.

 

 

This Project was done by:

Pavan Konanki: kpavan@vt.edu

Gokulnath Kannan: gomaths@cs.vt.edu

Ajith Sowndararajan: ajiths@vt.edu