This commit is contained in:
Burt Harris 2016-09-23 13:46:45 -07:00
commit fdfe97c813
4 changed files with 30 additions and 13 deletions

View File

@ -15,18 +15,18 @@ ANTLR project lead and supreme dictator for life
## Useful information ## Useful information
* [Release notes](https://github.com/antlr/antlr4/releases) * [Release notes](https://github.com/antlr/antlr4/releases)
* [Getting started with v4](https://raw.githubusercontent.com/antlr/antlr4/master/doc/getting-started.md) * [Getting started with v4](https://github.com/antlr/antlr4/blob/master/doc/getting-started.md)
* [Official site](http://www.antlr.org/) * [Official site](http://www.antlr.org/)
* [Documentation](https://raw.githubusercontent.com/antlr/antlr4/master/doc/index.md) * [Documentation](https://github.com/antlr/antlr4/blob/master/doc/index.md)
* [FAQ](https://raw.githubusercontent.com/antlr/antlr4/master/doc/faq/index.md) * [FAQ](https://github.com/antlr/antlr4/blob/master/doc/faq/index.md)
* [API](http://www.antlr.org/api/Java/index.html) * [API](http://www.antlr.org/api/Java/index.html)
* [ANTLR v3](http://www.antlr3.org/) * [ANTLR v3](http://www.antlr3.org/)
* [v3 to v4 Migration, differences](https://raw.githubusercontent.com/antlr/antlr4/master/doc/faq/general.md) * [v3 to v4 Migration, differences](https://github.com/antlr/antlr4/blob/master/doc/faq/general.md)
You might also find the following pages useful, particularly if you want to mess around with the various target languages. You might also find the following pages useful, particularly if you want to mess around with the various target languages.
* [How to build ANTLR itself](https://raw.githubusercontent.com/antlr/antlr4/master/doc/building-antlr.md) * [How to build ANTLR itself](https://github.com/antlr/antlr4/blob/master/doc/building-antlr.md)
* [How we create and deploy an ANTLR release](https://raw.githubusercontent.com/antlr/antlr4/master/doc/releasing-antlr.md) * [How we create and deploy an ANTLR release](https://github.com/antlr/antlr4/blob/master/doc/releasing-antlr.md)
## The Definitive ANTLR 4 Reference ## The Definitive ANTLR 4 Reference

View File

@ -92,3 +92,4 @@ YYYY/MM/DD, github id, Full name, email
2016/03/27, beardlybread, Bradley Steinbacher, bradley.j.steinbacher@gmail.com 2016/03/27, beardlybread, Bradley Steinbacher, bradley.j.steinbacher@gmail.com
2016/03/29, msteiger, Martin Steiger, antlr@martin-steiger.de 2016/03/29, msteiger, Martin Steiger, antlr@martin-steiger.de
2016/03/28, gagern, Martin von Gagern, gagern@ma.tum.de 2016/03/28, gagern, Martin von Gagern, gagern@ma.tum.de
2016/08/19, andjo403, Andreas Jonson, andjo403@hotmail.com

View File

@ -63,7 +63,22 @@ TestTemplates ::= [
... ...
``` ```
For every name mentioned, you will find a `.stg` file with the actual test. E.g., `Sets/StarSet.stg`: For every name mentioned, you will find a `.stg` file with the actual test template. E.g., `Sets/StarSet.stg`.
Each `.stg` file descripes the following mandatory elements for the test:
- the test type: "Parser" or "Lexer"
- some ANTLR options, such as "Debug"
- the grammar
- the start rule
- the input i.e. the text to parse
- the expected output
- the expected errors
The grammar can itself contain template expressions such as <something>.
The test generator replaces these with the corresponding values from the target language template (see below).
It then generates a unit test in which the grammar, the input and the expected output and errors are inlined.
Here is an example test template:
``` ```
TestType() ::= "Parser" TestType() ::= "Parser"
@ -92,6 +107,7 @@ a : ('a'|'b')* 'c' {<InputText():writeln()>} ;
>> >>
``` ```
### Cross-language actions embedded within grammars ### Cross-language actions embedded within grammars
To get: To get:

View File

@ -13,14 +13,14 @@ The first step is to get the Java source code from the ANTLR 4 repository at git
```bash ```bash
$ cd /tmp $ cd /tmp
/tmp $ git clone git@github.com:antlr/antlr4.git /tmp $ git clone https://github.com/antlr/antlr4.git
Cloning into 'antlr4'... Cloning into 'antlr4'...
remote: Counting objects: 43273, done. remote: Counting objects: 61480, done.
remote: Compressing objects: 100% (57/57), done. remote: Total 61480 (delta 0), reused 0 (delta 0), pack-reused 61480
remote: Total 43273 (delta 26), reused 0 (delta 0) Receiving objects: 100% (61480/61480), 31.24 MiB | 7.18 MiB/s, done.
Receiving objects: 100% (43273/43273), 18.76 MiB | 1.60 MiB/s, done. Resolving deltas: 100% (32970/32970), done.
Resolving deltas: 100% (22419/22419), done.
Checking connectivity... done. Checking connectivity... done.
Checking out files: 100% (1427/1427), done.
``` ```
# Compile # Compile