A Visual IDE-Style LL(k) Parser Generator that
uses an editable tree with icons for tokens and non-terminals to
represent the grammar symbols and grammar rules.
The tool is completely interactive. Errors in the grammar are indicated
by adorning the affected icons as the rule-tree is edited, and the
generated parser code is displayed in an adjacent pane so the effect of
edits on the rule-tree can be immediately verified.
The visual tree representation of grammar rules completely eliminates
the need to use and understand cryptic specifications as used in YACC,
ANTLR and JavaCC. The grammar is saved to (and read from) data
files using pure-Java mechanisms.
The built-in scanner can also be customized for the application via the
GUI.
How to run the demos
Download the VisualLangLab.zip file. When unzipped, there should be five files:
ReadMe.1st (summary instructions), VisualLangLab.jar (the Java executable), docs (the
documentation directory) demos (some interesting demos) and test-cases (a directory
for the test cases and data).
Start VisualLangLab by double clicking the VisualLangLab.jar
icon (or using the command line: java -jar VisualLangLab.jar).
Recommended: Go directly to the Java-1.4
grammar (use the File->Open menu to choose the grammar file
demos/java-1.4/java14C.lkv). Explore VisualLangLab features using this
grammar. Please do not change any demo grammar files. Reading the
documentation (in the file docs/index.html) at this stage is highly recommended.
You may generate the Java-1.4 parser using the File->Write code menu.
Compile the generated parser (a file called java14C.java) as
described below, and run as follows: java java14C -f <source-file>.
A successful parse produces no output (error messages). Note:
VisualLangLab.jar must be in the classpath during compilation as well as during
execution.
The test-cases directory also contains several other pairs of
grammar and input files (e.g. test_00_00.lkv and
test_00_00.txt). Note: the grammar files (*.lkv) can be
opened by VisualLangLab, but are not human-readable.
The input files (*.txt) are text files, and contain parser testing
input and comments.
Open a grammar file using the File->Open menu. (The file-chooser
dialog only displays *.lkv files by default.)
Generate parser code using the File->Write code menu. A file named
fooBar.java is created in the directory containing the grammar file
(fooBar.lkv being the name of the grammar file).
Compile the parser: javac fooBar.java . Note:
VisualLangLab.jar must be in the CLASSPATH.
Run the parser: java fooBar -f fooBar.txt. Note:
VisualLangLab.jar must be in the CLASSPATH. The fooBar.txt
files are the *.txt files in the test-cases directory.
When the demo runs as expected, the parser produces the
output OK. Any other output indicates an error.
The parser generated from the grammar test_Exp_99.lkv (an expression
evaluator) should be run with the input files named test_Exp_00.txt,
test_Exp_01.txt etc.