• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1ANTLR v3.4
2July 18, 2011
3
4Terence Parr, parrt at cs usfca edu
5ANTLR project lead and supreme dictator for life
6University of San Francisco
7
8INTRODUCTION
9
10Welcome to ANTLR v3!  ANTLR (ANother Tool for Language Recognition) is
11a language tool that provides a framework for constructing
12recognizers, interpreters, compilers, and translators from grammatical
13descriptions containing actions in a variety of target
14languages. ANTLR provides excellent support for tree construction,
15tree walking, translation, error recovery, and error reporting. I've
16been working on parser generators for 20 years and on this particular
17version of ANTLR for 7 years.
18
19You should use v3 in conjunction with ANTLRWorks:
20
21    http://www.antlr.org/works/index.html
22
23and gUnit (grammar unit testing tool included in distribution):
24
25    http://www.antlr.org/wiki/display/ANTLR3/gUnit+-+Grammar+Unit+Testing
26
27The book will also help you a great deal (printed May 15, 2007); you
28can also buy the PDF:
29
30    http://www.pragmaticprogrammer.com/titles/tpantlr/index.html
31
322nd book, Language Implementation Patterns:
33
34    http://pragprog.com/titles/tpdsl/language-implementation-patterns
35
36See the getting started document:
37
38    http://www.antlr.org/wiki/display/ANTLR3/FAQ+-+Getting+Started
39
40You also have the examples plus the source to guide you.
41
42See the wiki FAQ:
43
44    http://www.antlr.org/wiki/display/ANTLR3/ANTLR+v3+FAQ
45
46and general doc root:
47
48    http://www.antlr.org/wiki/display/ANTLR3/ANTLR+3+Wiki+Home
49
50Please help add/update FAQ entries.
51
52If all else fails, you can buy support or ask the antlr-interest list:
53
54    http://www.antlr.org/support.html
55
56Per the license in LICENSE.txt, this software is not guaranteed to
57work and might even destroy all life on this planet:
58
59THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
60IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
61WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
62DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
63INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
64(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
65SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
66HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
67STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
68IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
69POSSIBILITY OF SUCH DAMAGE.
70
71----------------------------------------------------------------------
72
73EXAMPLES
74
75ANTLR v3 sample grammars:
76
77    http://www.antlr.org/download/examples-v3.tar.gz
78
79Examples from Language Implementation Patterns:
80
81    http://www.pragprog.com/titles/tpdsl/source_code
82
83Also check out Mantra Programming Language for a prototype (work in
84progress) using v3:
85
86    http://www.linguamantra.org/
87
88----------------------------------------------------------------------
89
90What is ANTLR?
91
92ANTLR stands for (AN)other (T)ool for (L)anguage (R)ecognition
93and generates LL(*) recursive-descent parsers. ANTLR is a language tool
94that provides a framework for constructing recognizers, compilers, and
95translators from grammatical descriptions containing actions.
96Target language list:
97
98http://www.antlr.org/wiki/display/ANTLR3/Code+Generation+Targets
99
100----------------------------------------------------------------------
101
102How is ANTLR v3 different than ANTLR v2?
103
104See "What is the difference between ANTLR v2 and v3?"
105
106    http://www.antlr.org/wiki/pages/viewpage.action?pageId=719
107
108See migration guide:
109
110    http://www.antlr.org/wiki/display/ANTLR3/Migrating+from+ANTLR+2+to+ANTLR+3
111
112----------------------------------------------------------------------
113
114How do I install this damn thing?
115
116Just untar antlr-3.4.tar.gz and you'll get:
117
118antlr-3.4/BUILD.txt
119antlr-3.4/antlr3-maven-plugin
120antlr-3.4/antlrjar.xml
121antlr-3.4/antlrsources.xml
122antlr-3.4/gunit
123antlr-3.4/gunit-maven-plugin
124antlr-3.4/pom.xml
125antlr-3.4/runtime
126antlr-3.4/tool
127antlr-3.4/lib
128
129This is the source and java binaries.  You could grab the
130antlr-3.4-complete.jar file from the website, but it's in lib dir.
131It has all of the jars you need combined into one. Then you need to
132add antlr-3.4-complete.jar to your CLASSPATH or add
133to arg list; e.g., on unix:
134
135$ java -cp "/usr/local/lib/antlr-3.4-complete.jar:$CLASSPATH" org.antlr.Tool Test.g
136
137Please see the FAQ
138
139    http://www.antlr.org/wiki/display/ANTLR3/ANTLR+v3+FAQ
140