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:
- Grammar pane: This pane displays the grammar
and highlights the currently considered production along with the
currently considered symbol in the production.
- First Set pane: This pane displays the first set
of each non terminal in the current state.
- Explanation pane: This pane displays an explanation
of all the steps from the beginning to the current state.
The screen provides the following
controls:
- Next button: This button allows the user to
progress to the next state in first set construction
- Previous button: This button allows the user to
progress to the previous state in first set construction
- Beginning button: This button enables the user to
restart the first set construction from the beginning
- 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
- 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:
- Grammar pane: This pane displays the grammar
and highlights the currently considered production along with the
currently considered symbol in the production.
- 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.
- Follow Set pane: This pane displays the follow set
of each non terminal in the current state.
- Explanation pane: This pane displays an explanation
of all the steps from the beginning to the current state.
The screen provides the following
controls:
- Next button: This button allows the user to
progress to the next state in follow set construction
- Previous button: This button allows the user to
progress to the previous state in follow set construction
- 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
- 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.
- 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.
- 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:
- 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.
- 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.
- Parsing table pane: This pane displays the current
state of the parsing table.
- 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:
- Beginning button: Moves to the first state in the
parsing table construction phase
- End button: Moves to the last state in the
parsing table construction phase
- Next button: Moves to the next state in the
parsing table construction phase. This button is enabled only in step
mode.
- Previous button: Moves to the previous state in
the parsing table construction phase. This button is only enabled in the
step mode
- 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.
- 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:
- Grammar pane: This pane displays the grammar.
- Explanation pane: This pane maintains an
explanation of all the steps that occurred from the beginning of the phase
to the current state.
- 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)
- 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)
- Input text box: The input to be parsed must be
entered in this box
The screen provides the following
controls:
- Next button: This button allows the user to
progress to the next state in input string parsing
- Previous button: This button allows the user to
progress to the previous state in input string parsing
- 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)
- Beginning button: This button enables the user to
restart the input string parsing from the beginning
- 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