The grammar notation is based on general scannerless context-free grammars with various extensions (ignorable entities, equality entities, regular expression terminals, unordered productions, and production priorities). The parser is an eager variant of Earley's algorithm. (The parser is not intended to be particularly efficient - its main goal is to work as a foundation for the XSugar tool and the ambiguity analyzer.) The grammar ambiguity analyzer uses the ACLA technique (Ambiguity Checking with Language Approximations) described in the research paper "Analyzing Ambiguity of Context-Free Grammars" (see below).
- View the online javadoc API specifications.
- Download
- grammar.jar - precompiled Java archive, or
- grammar-all.jar - full jar including necessary libraries (dk.brics.automaton and JSA)
The tool can be used from the command-line:
java -jar grammar-all.jar
Run without arguments to start the GUI version; run with option -h to see the command-line usage. For viewing parse trees in the GUI version, you need Graphviz dot. - See the description of the textual notation of grammars.
- Try the online demo.
- Source code is available on request.
- Read the research paper:
Analyzing Ambiguity of Context-Free Grammars
[ abstract |
PDF
]
You may also be interested in reading Michael Kruse's B.Sc. thesis [ PDF ]
- The XSugar tool uses the package for translating between XML and non-XML syntax and checking reversibility.
- The tool has been integrated into Grammar Studio by DotVocal.
The dk.brics.grammar package is developed by Anders Møller at Aarhus University.