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