The license of this project is Apache 2.0.
Requires Java 7 or later.
The latest versions are:
- development: 2.1.0-beta.3; requires Java 8 (this is 2016, after all);
- stable: 2.0.4. requires Java 7.
This package allows you to write grammars entirely in Java. Unlike, for instance, ANTLR and JavaCC, parsers written with this package do not require a pre-processing phase. Yes, this means you generate your parsers at runtime. And there is no DSL. Pure Java!
See also the debugger package.
Well, you write grammars and can then generate parsers for them. (I also happen to like the drink of the same name)
There are three major versions.
This version is currently in development. See here for a list of changes from 2.0.x.
The latest 2.0.x version is 2.0.4. Using gradle:
dependencies {
compile(group: "com.github.fge", name: "grappa", version: "2.0.4");
}
Grappa in itself does not generate a parse tree. While you can do it yourself, a module exists which allows you to do exactly that with little effort:
https://github.com/ChrisBrenton/grappa-parsetree
A visualizer (using Graphviz) also exists for such parse trees: https://github.com/fge/grappa-parsetree-visual
A project, currently in development, will allow you to generate a grappa parser from a formal grammar (BNF, EBNF, WSN, others) at runtime. See here:
https://github.com/ChrisBrenton/grappa-formal
The following projects, all on GitHub, use grappa:
- https://github.com/Offene-Bibel/converter (1.0.x);
- https://github.com/uscexp/grappa.extension (1.0.x);
- https://github.com/haasted/grappa-xml-parser (1.0.x);
- https://github.com/opennars/opennars (2.0.x);
- https://github.com/litesolutions/sonar-sslr-grappa (2.0.x);
- https://github.com/hatstand0/Staskken (2.0.x).
Unfortunately, I still haven't documented the project properly.
Here is a link to a tutorial by Joseph Ottinger explaining a possible use of grappa:
http://enigmastation.com/2016/03/07/simple-grappa-tutorial/
The code for this tutorial is available on GitHub.
I have also put up a project with some sample grammars; in particular, a grammar which is able to fully parse any JSON:
https://github.com/fge/grappa-examples
This project has an IRC channel (#grappa
on Freenode; server: irc.freenode.net
) and two
dedicated Google groups: grappa-users and
grappa-devel. They are also available to post by
email.