Shift-Reduce Parser Applet

Last Update Time-stamp: "97/06/28 17:18:04 umrigar"

This page contains a java applet which demonstrates the operation of a recursive-descent parser for a simple language consisting of assignment statements and arithmetic expressions. An introduction to shift-reduce parsing is also available.

Applet Layout

The layout of the applet is as shown below. You can click on any of the yellow areas to get a fuller description in the frame to the left.

Running the Applet

Please be patient: depending on the speed of your network connection, the applet may take a few minutes to load. Here it is...


Your browser does not appear to be java-enabled.


If you find the size of the applet embedded above inconvenient, then you can start (but your browser doesn't appear to be java-enabled) :-( another copy of the applet in a separate window which you may resize to your convenience (if permitted to do so by the security model used by your browser).

Any misbehavior of the applet may be due to known incompatiblities.

If you have clicked the update button in the applet above and if your platform is suitable, then the details (LR(0) items, etc) of the current state are shown in the browser frame to the left of this frame. You can click on the links in that frame to look at the details of the parser construction.

The traditional goto step of traditional compiler texts, is broken up into two substeps by the applet. In the first substep, the subtree for the reduction is constructed off the stack. In the second substep, the state revealed on top of the stack is used to lookup the goto table and put the constructed subtree onto the stack.

A word about parser start-up and termination. The parse-tree shown in the applet's top window does not include the effects of the augmenting production:

	$S: program <EOF> 

Hence, when the parser starts up, the first step which puts $S onto the parse stack has no effect on the parse-tree. Similarly, an attempt to reduce by the augmenting production effectively terminates the parse.


Feedback: Please email any feedback to zdu@acm.org.

Up to Parsing Demos Main Page Shift-Reduce Parsing Page