Free Web space and hosting from 2itb.com
Search the Web

LL(1) Table Driven Parser Demonstration

This is an applet to demonstrate interactively the workings of a LL(1) table driven parser. The grammar used to generate the parse table in the applet is taken from the current 'CS2 Language and Processing note 12'.

The grammar describes the language of commands such as one might type into a shell, where a command name (e.g. ls, cp) is followed by some options and some files. The grammar is as follows:

S -> command ARGS
ARGS -> OPTS FILES
OPTS -> option OPTS
OPTS -> epsilon
FILES -> file FILES
FILES -> epsilon

Where uppercase represents non-terminals, and lower-case represents terminals.

Input a string to parse into the text box with each token separated by whitespace, pressing return when finished. For example "command option file $". Now it is possible to try the following:

LL(1) Parser:

Other features implemented in the non-applet version include: the option to print parse trees, and the ability to generate parse tables to use in the applet/application from any user supplied grammar.

Any comments on features that you think would be useful to include, if you find a bug :( or any comments in general would be extremely appreciated. E-mail me at ais@dcs.ed.ac.uk

Thank You




4494