| Original author(s) | Terence Parr and others |
|---|---|
| Initial release | February 1992 |
| Stable release | 3.2 / September 23, 2009 |
| Written in | Java |
| Platform | Cross-platform |
| Development status | in active development |
| License | BSD License |
| Website | http://www.antlr.org/ |
In computer based language recognition, ANother Tool for Language Recognition (ANTLR) is the name of a parser generator that uses LL(*) parsing. ANTLR is the successor to the Purdue Compiler Construction Tool Set (PCCTS), first developed in 1989, and is under active development. Its maintainer is professor Terence Parr of the University of San Francisco.
ANTLR takes as input a grammar that specifies a language and generates as output, source code for a recognizer for that language. At the moment, ANTLR supports generating code in C, Java, Python, C#, and Objective-C. A language is specified using a context free grammar which is expressed using Extended Backus Naur Form EBNF.
ANTLR allows for generation of parsers, lexers, tree parsers and combined lexer parsers. Parsers can automatically generate Abstract Syntax Trees which can be further processed with tree parsers. ANTLR provides a single consistent notation for specifying lexers, parsers and tree parsers. This is in contrast with other parser/lexer generators and adds greatly to the tool's ease of use.
By default ANTLR takes a grammar and generates a recognizer for that grammar, that is a program that takes an input stream and generates an error if the input stream does not conform to the syntax specified by the grammar. If there are no syntax errors then the default action is to simply exit without printing any message. In order to something useful with the language, actions can be attached to grammar elements in the grammar. These actions are written in the programming language that the recognizer is being generated. When the recognizer is being generated the actions are embededed in the source code of the recognizer at the appropriate points. Actions can be used to build and check symbol tables and to emit instructions in a target language, in the case of a compiler.
As well as lexers and parsers, ANTLR can be used to generate tree parsers. These are recognizers that process Abstract Syntax Trees which can be automatically generated by parsers. These tree parsers are unique to ANTLR and greatly simplify the processing of Abstract Syntax Trees.
Previous versions of ANTLR provided free comprehensive online documentation. This is not the case with version 3. A book, The Definitive ANTLR Reference, is available, however (see below). The book is both a tutorial and a reference and it is both easy to read and comprehensive.
ANTLR 3 is free software, published under a 3-clause BSD License. (Previous versions were released as public domain software.[1])
Several plugins have been developed for the Eclipse development environment to support the ANTLR grammar. There is ANTLR Studio, a proprietary product, as well as the ANTLR 2 and 3 plugins for Eclipse hosted on SourceForge.
|
|