Created How to build ANTLR itself (markdown)

Terence Parr 2015-01-13 18:51:37 -08:00
parent 492db3489f
commit e2b579cba4
1 changed files with 35 additions and 0 deletions

@ -0,0 +1,35 @@
Most programmers do not need the information on this page because they will simply download the appropriate jar(s) or use ANTLR through maven (via ANTLR's antlr4-maven-plugin). If you would like to fork the project and fix bugs or tweak the runtime code generation, then you will almost certainly need to build ANTLR itself. There are two components:
1 the tool that compiles grammars down into parsers and lexers in one of the target languages
1 the runtime used by those generated parsers and lexers.
As of 4.4, we use a Python script in the main directory called bild.py, which will bootstrap by pulling in the bilder.py library. You don't need to know much about what's inside, but the code is reasonably easy to read.
# Get the source
The first step is to get the Java source code from the ANTLR 4 repository at github. You can download the repository from github, but the easiest thing to do is simply clone the repository on your local disk:
```bash
terence:/tmp $ git clone git@github.com:antlr/antlr4.git
Cloning into 'antlr4'...
remote: Counting objects: 43273, done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 43273 (delta 26), reused 0 (delta 0)
Receiving objects: 100% (43273/43273), 18.76 MiB | 1.60 MiB/s, done.
Resolving deltas: 100% (22419/22419), done.
Checking connectivity... done.
```
# Compiling
Compiling the source code is easy:
```bash
terence:master:/tmp/antlr4 $ ./bild.py compile
bootstrapping; downloading bilder.py
target compile
require parsers
build compile
bild succeeded
```