SUPPORT THE WORK

GetWiki

ANTLR

ARTICLE SUBJECTS
aesthetics  →
being  →
complexity  →
database  →
enterprise  →
ethics  →
fiction  →
history  →
internet  →
knowledge  →
language  →
licensing  →
linux  →
logic  →
method  →
news  →
perception  →
philosophy  →
policy  →
purpose  →
religion  →
science  →
sociology  →
software  →
truth  →
unix  →
wiki  →
ARTICLE TYPES
essay  →
feed  →
help  →
system  →
wiki  →
ARTICLE ORIGINS
critical  →
discussion  →
forked  →
imported  →
original  →
ANTLR
[ temporary import ]
please note:
- the content below is remote from Wikipedia
- it has been imported raw for GetWiki
{{more citations needed|date=March 2016}}







factoids
}}In computer-based language recognition, ANTLR (pronounced antler), or ANother Tool for Language Recognition, is a parser generator that uses a LL(*) algorithm for 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.{{citation needed|date=March 2016}}PCCTS 1.00 was announced April 10, 1992.WEB, 10 Apr 1992, Comp.compilers: Purdue Compiler-Construction Tool Set 1.00 available,compilers.iecc.com/comparch/article/92-04-048, 2023-05-05, compilers.iecc.com, WEB, 30 Apr 1992, Comp.compilers: More on PCCTS,compilers.iecc.com/comparch/article/92-05-006, 2023-05-05, compilers.iecc.com,

Usage

ANTLR takes as input a grammar that specifies a language and generates as output source code for a recognizer of that language. While Version 3 supported generating code in the programming languages Ada95, ActionScript, C, C#, Java, JavaScript, Objective-C, Perl, Python, Ruby, and Standard ML,SML/NJ Language Processing Tools: User Guide Version 4 at present targets C#,C++,Dart,WEB, Runtime Libraries and Code Generation Targets,github.com/antlr/antlr4/blob/master/doc/targets.md, github, 6 January 2022, WEB,soft-gems.net/the-antlr4-c-runtime-reached-home, The ANTLR4 C++ runtime reached home – Soft Gems, Java, JavaScript, Go,PHP,Python (2 and 3), and Swift.A language is specified using a context-free grammar expressed using Extended Backus–Naur Form (EBNF).{{citation needed|date=March 2016}}BOOK, Parr, Terence,books.google.com/books?id=gA9QDwAAQBAJ, The Definitive ANTLR 4 Reference, 2013-01-15, Pragmatic Bookshelf, 978-1-68050-500-9, en, ANTLR can generate lexers, parsers, tree parsers, and combined lexer-parsers. Parsers can automatically generate parse trees or abstract syntax trees, which can be further processed with tree parsers. ANTLR provides a single consistent notation for specifying lexers, parsers, and tree parsers.By default, ANTLR reads a grammar and generates a recognizer for the language defined by the grammar (i.e., a program that reads 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, the default action is to simply exit without printing any message. In order to do something useful with the language, actions can be attached to grammar elements in the grammar. These actions are written in the programming language in which the recognizer is being generated. When the recognizer is being generated, the actions are embedded 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.{{citation needed|date=March 2016}}Other than 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 help processing abstract syntax trees.{{citation needed|date=March 2016}}

Licensing

{{citation needed span|date=September 2017|text=ANTLR 3}} and ANTLR 4 are free software, published under a three-clause BSD License.WEB, 2017-03-30, antlr4/LICENSE.txt, GitHub,github.com/antlr/antlr4/blob/master/LICENSE.txt, Prior versions were released as public domain software.MAILING LIST,www.antlr.org/pipermail/antlr-interest/2004-February/006340.html, licensing stuff, 2004-02-05, 2009-12-15, antlr-interest, Parr, Terence, dead,www.antlr.org/pipermail/antlr-interest/2004-February/006340.html," title="web.archive.org/web/20110718165021www.antlr.org/pipermail/antlr-interest/2004-February/006340.html,">web.archive.org/web/20110718165021www.antlr.org/pipermail/antlr-interest/2004-February/006340.html, 2011-07-18, Documentation, derived from Parr’s book The Definitive ANTLR 4 Reference, is included with the BSD-licensed ANTLR 4 source.WEB, 2017-03-30, ANTLR 4 Documentation, GitHub,github.com/antlr/antlr4/blob/master/doc/index.md, Various plugins have been developed for the Eclipse development environment to support the ANTLR grammar, including ANTLR Studio, a proprietary product, as well as the “ANTLR 2“WEB,antlreclipse.sourceforge.net, ANTLR plugin for Eclipse, and “ANTLR 3“WEB,antlrv3ide.sourceforge.net, ANTLR IDE. An eclipse plugin for ANTLR grammars, plugins for Eclipse hosted on SourceForge.{{citation needed|date=March 2016}}

ANTLR 4

ANTLR 4 deals with direct left recursion correctly, but not with left recursion in general, i.e., grammar rules x that refer to y that refer to x.What is the difference between ANTLR 3 & 4

Development

As reported on the toolsWEB,www.antlr.org/tools.html, ANTLR Development Tools, page of the ANTLR project, plug-ins that enable features like syntax highlighting, syntax error checking and code completion are freely available for the most common IDEs (Intellij IDEA, NetBeans, Eclipse, Visual StudioWEB,marketplace.visualstudio.com/items?itemName=SamHarwell.ANTLRLanguageSupport, ANTLR Language Support - Visual Studio Marketplace, and Visual Studio Code).

Projects

Software built using ANTLR includes: Over 200 grammars implemented in ANTLR 4 are available on GitHub.{{Citation|title=Grammars written for ANTLR v4; expectation that the grammars are free of actions.: antlr/grammars-v4|date=2019-09-25|url=https://github.com/antlr/grammars-v4|publisher=Antlr Project|access-date=2019-09-25}} They range from grammars for a URL to grammars for entire languages like C, Java and Go.

Example

In the following example, a parser in ANTLR describes the sum of expressions can be seen in the form of “1 + 2 + 3”:
// Common options, for example, the target language
options
{
language = “CSharp”;
}
// Followed by the parser
class SumParser extends Parser;
options
{
k = 1; // Parser Lookahead: 1 Token
}
// Definition of an expression
statement: INTEGER (PLUS^ INTEGER)*;
// Here is the Lexer
class SumLexer extends Lexer;
options
{
k = 1; // Lexer Lookahead: 1 characters
}
PLUS: ‘+’;
DIGIT: (’0’..’9’);
INTEGER: (DIGIT)+;
The following listing demonstrates the call of the parser in a program:
TextReader reader;
// (...) Fill TextReader with character
SumLexer lexer = new SumLexer(reader);
SumParser parser = new SumParser(lexer);


parser.statement();

See also

References

{{reflist|30em}}

Bibliography

  • {{citation
last1=Parr |date=May 17, 2007 edition=1st Pragmatic Bookshelf >pages=376 |isbn=978-0-9787392-5-6 | url=http://www.pragprog.com/titles/tpantlr/the-definitive-antlr-reference }}
  • {{citation
last1=Parr |date=December 2009 | title=Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages publisher=Pragmatic Bookshelf isbn=978-1-934356-45-6 | url=http://www.pragprog.com/titles/tpdsl/language-implementation-patterns }}
  • {{citation
last1=Parr |date= January 15, 2013 edition=1st Pragmatic Bookshelf >pages=328 |isbn=978-1-93435-699-9| url=http://pragprog.com/book/tpantlr2/the-definitive-antlr-4-reference }}

Further reading

  • JOURNAL, T.J., Parr, R.W., Quong, ANTLR: A Predicated-LL(k) Parser Generator, Software: Practice and Experience, 25, 7, 789–810, July 1995, 10.1002/spe.4380250705, 10.1.1.54.6015, 13453016,

External links



- content above as imported from Wikipedia
- "ANTLR" does not exist on GetWiki (yet)
- time: 8:11am EDT - Wed, May 22 2024
[ this remote article is provided by Wikipedia ]
LATEST EDITS [ see all ]
GETWIKI 21 MAY 2024
GETWIKI 09 JUL 2019
Eastern Philosophy
History of Philosophy
GETWIKI 09 MAY 2016
GETWIKI 18 OCT 2015
M.R.M. Parrott
Biographies
GETWIKI 20 AUG 2014
CONNECT