Shift-Reduce Parser Applet: Output Windows
Last Update Time-stamp: "97/06/27 19:15:18 umrigar"
The shift-reduce parser displays its output in three windows:
Parse Forest Window
The top window displays the parse forest as it is being constructed. Nodes
which are still on the parse stack
are shown in green (these nodes are always root nodes and appear across the
top of the window --- tracing this line of green nodes gives the contents of
the parse stack). When a node is removed from the parse stack, it's color
is changed to red. As the parser is stepped, the window will always display
the current node of interest which is highlighted in yellow.
Shift-Reduce Parse Table Window
This shows the action and goto tables. The rows correspond to
the states; the initial columns indexed by terminals correspond to
the action table; the subsequent columns indexed by nonterminal correspond
to the goto table. The table entries are represented as follows:
Shift n
A shift on a terminal symbol to state number n is represented as
s
n.
Reduce n
A reduction by rule number n is represented as
r
n.
Goto n
A goto on a nonterminal symbol to state number n is represented as
g
n.
The currently active entry in the parse table is highlighted.
Trace Window
This window shows the trace history in the format used in classical compiler
texts. Each trace line consists of the stack (in green) followed by the
input (in black) which is yet to be processed. The current lookahead token
is always the first token in the unexpended input. Each stack entry is of
the form State/
Sym where State
is the state number and Sym is the grammar symbol which accesses
that state. The stack contents correspond to the green nodes in the parse
tree.
Each window displays a brief description of itself for a short period
after the mouse pointer enters it.
Feedback: Please email any feedback to zdu@acm.org.
Up to Parsing Demos Main Page