/grappa-parsetree-visual

Generate an SVG from a generated parse tree

Primary LanguageJavaApache License 2.0Apache-2.0

READ ME FIRST

This package is licensed under ASL 2.0. See the LICENSE file at the root of the project for the full text.

This package requires Java 8 or later.

The current version is 1.0.1.

What this is

This package takes a parse tree as generated by grappa-parsetree and generates an SVG file out of this parse tree.

For this, it first generates a DOT file from the parse tree, then calls Graphviz's dot command to generate the SVG.

Requirements

Apart from a Java 8 JRE, this program also requires that Graphviz be installed on the target machine, and that the dot command is available on your PATH.

Using it

Using gradle:

dependencies {
    compile(group: "com.github.fge", name: "grappa-parser-visual",
        version: "1.0.1");
}

Using maven:

<dependencies>
    <dependency>
        <groupId>com.github.fge</groupId>
        <artifactId>grappa-parser-visual</artifactId>
        <version>1.0.1</version>
    </dependency>
</dependencies>

Example

You can see an example here.

This example uses a simple expression parser (which is in the same directory as the source example), parses the input and generates an SVG file named examples.svg in your temporary directory (typically, /tmp on Unix-like systems).