Grammar installation

Note

This is only required if you want to autogenerate new Blackbird parsers for additional target languages, or if you want to modify the Blackbird grammar directly.

If instead you want to utilize the existing ready-built Python/C++ Blackbird parsers, see the individual installation details for installing the Python parser and compiling and installing the C++ parser.

Compiling the grammar

Note

This step is optional - Blackbird is packaged with the ANTLR grammar already pre-compiled, for both C++ and Python.

To compile the grammar, you will need to make sure that Java version 1.6 and higher is installed. Once Java is installed, use the following steps to install ANTLR 4.9.2:

$ cd /usr/local/lib
$ sudo wget https://www.antlr.org/download/antlr-4.9.2-complete.jar
$ export CLASSPATH=".:/usr/local/lib/antlr-4.9.2-complete.jar:$CLASSPATH"
$ alias antlr4='java -jar /usr/local/lib/antlr-4.9.2-complete.jar'
$ alias grun='java org.antlr.v4.gui.TestRig'

You can then autogenerate the Python and C++ base listeners and visitors by navigating to the Blackbird root directory, and running make grammar.

Documentation

To build the documentation, the following additional packages are required:

These can both be installed via pip:

$ python3 -m pip install sphinx sphinxcontrib-bibtex

To build the HTML documentation, go to the top-level directory and run

$ make docs

The documentation can then be found in the doc/_build/html/ directory.