Skip to content

Latest commit

 

History

History
98 lines (61 loc) · 2.94 KB

README.md

File metadata and controls

98 lines (61 loc) · 2.94 KB

Read me first

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.

What this is

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.

And, uh, the name?

Well, you write grammars and can then generate parsers for them. (I also happen to like the drink of the same name)

Versions

There are three major versions.

2.1.x

This version is currently in development. See here for a list of changes from 2.0.x.

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");
}

Projects using grappa

Parse tree generator

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

More advanced usage...

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

Other usages

The following projects, all on GitHub, use grappa:

Examples

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

Getting help

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.