About ANTLR |
Latest version is 2.7.7.
Download now! »
ANTLR via Clojure
Brian Carper (Submitted by TJP) Sun Jul 18, 2010 07:34
Can you use ANTLR from Clojure? Sure. Would you want to? Maybe. Here's how to do it, start to finish.
Bill Bejeck Fri Mar 5, 2010 19:31
A tutorial on getting started with ANTLR. Covers the basics of writing a simple grammar
ANTLR 3.x Video Tutorial
Scott Stanchfield Mon Dec 14, 2009 11:26
I've converted my ANTLR 2.x tutorial to ANTLR 3.x in the most lazy way possible - video!
Implementing parsers and state machines in Java
Terence Parr Fri Oct 2, 2009 15:39
Slides and video for my talk at 2009 JVM language summit. Topics: Generated method size in parsers, Why I need DFA in my parsers, Implementing DFA in Java, Predicated DFA edges, My kingdom for dynamic scoping, Exceptions for flow-control, Computed gotos for interpreter instruction dispatch.
Write Your Own Language With ANTLR 3 and the DLR
Dermot Hogan Tue Sep 2, 2008 10:47
Ever had trouble learning a computer language in the past? Well why not dump the C++ manuals and start writing your very own language to do exactly what you want? If this sounds impossibly difficult, or only suitable for Computer Science professors ? it was until very recently. But two new developments have made language writing (as opposed to reading) possible for mere mortals. The first is ANTLR3- a totally new version of the highly popular ANTLR2 parser system. And the second is Microsoft?s revolutionary Dynamic Language Runtime.
Mark Volkmann Mon Jun 2, 2008 12:18
A large article talking about how to use ANTLR 3.0.
The Reuse of Grammars with Embedded Semantic Actions
Terence Parr Thu Apr 3, 2008 10:33
My keynote paper for IEEE International Conference on Program Comprehension 2008
Why I Don't Use StringTemplate For Language Translation
Andy Tripp Tue Jan 10, 2006 10:22
[Discussion here; look for subject "New article on StringTemplates and Treewalkers"] The case against AST treewalking and StringTemplate approaches for high-level language translation.
Debugging ANTLR grammars using ANTLR Studio
Prashant Deva Tue Jan 3, 2006 08:09
Debug grammar files with ease using ANTLR Studio.
Understanding ANTLR Grammar Files
Prashant Deva Thu Jun 23, 2005 15:32
Confused by all the different sections of an Antlr Grammar file. Take a look here and see how simple it all is.
Attribute Unification Proposal
Loring Craymer Tue May 17, 2005 01:50
An implementation model and syntax that integrates many of the attribute features discussed on the mailing list and elsewhere.
Humans Should Not Have To Grok XML
Terence Parr Thu Apr 21, 2005 10:13
XML makes a lousy human interface, but it's fine for data. ANT and RESIN and all you other xml-based config people please take note. Ugh. Heinous stuff.
Language Translation Using ANTLR and StringTemplate
Terence Parr Tue Feb 15, 2005 18:23
This article demonstrates how to translate a very simple C dialect, which I will call "C-" in honor of the grades I received in college, to three different languages, again using a single model and controller with multiple views. The targets are Java, Python, and bytecodes similar to the Jasmin Java bytecode assembler format. Merely swapping in a new template file generates completely different output without even recompiling the translator!
Translators Should Use Tree Grammars
Terence Parr Mon Nov 15, 2004 17:50
One of the most common questions programmers have when building a translator is, "what do I do with my AST now that I've built it?" Their first reaction is to use a visitor pattern that essentially does a depth-first-walk of the tree, executing an "action" method at each node. While easy to understand, this approach is not useful except for the simplest of translators. This small article illustrates the limitations of visitors and hints at the power of tree grammars.
Getting ANTLR to run on Cygwin and GCJ
Tom Verbeure Mon May 17, 2004 06:18
A recipe to get a working ANTLR system with Cygwin and GCJ.
Gu?a pr?ctica de ANTLR 2.7.2
Enrique Jos? Garc?a Cota Thu Jan 15, 2004 06:03
This is my end-of-studies project. It's a 450 pages book about ANTLR and compilers. It's in spanish. If you like ANTLR y entiendes espa?ol, you should have a look! You can download this other file: http://www.lsi.us.es/~troyano/documentos/guia-cap.zip if you want to have every chapter on a separated PDF file.
Syntax Directed TokenStream Rewriting
Terence Parr Sun Dec 14, 2003 15:00
There are many common situations where you want to tweak or augment a program or data file, but this has been hard since you have to add actions all over your grammar to spit the input back out. This article describes a very simple TokenStream buffer called TokenStreamRewriteEngine that makes it very easy to tweak files like SED on steroids. :)
Debugging and Testing Grammars With Parse Trees and Derivations
Terence Parr Sun Nov 30, 2003 20:54
Debugging big grammars is very difficult because the Human mind cannot easily trace the highly nested and recursive nature of parsing. This article describes a simple mechanism for getting parse trees / derivation sequences from your grammar for debugging and unit testing purposes; all without modifying ANTLR itself.
Enforcing Model-View Separation in Template Engines
Terence Parr Wed Nov 12, 2003 22:43
Formally defines output templates, template generational power, and business-logic/template separation rules. Both theoretically and empirically, shows strict separation of logic and display does not emasculate template generational power. Demonstrates StringTemplate at work solving some interesting HTML generation tasks.
Preserving Original Token Sequence In ASTs
Terence Parr Fri Sep 5, 2003 17:15
You want ASTs instead of parse trees for translation, but ASTs have the token order shuffled from the one-dimensional input sequence into a two-dimensional tree structure. Consequently, it is often hard to spit the original token sequence back out. You are required to build a tree walker that spits text back out. This article describes an experimental means of supporting easy x to x translation without modifying ANTLR itself. I provide modified token, token stream, tree node, and AST factory objects along with a simple grammar to demonstrate their use. This is damn cool stuff and will be standard equipment on ANTLR 3.
Selectively Matching XML Tag
Terence Parr Tue Jul 22, 2003 20:01
Title says it all :)
We Are Talking Really Big Lexical Lookahead Here
Terence Parr Tue Jul 22, 2003 20:00
This entry describes a tool that creates an HTML page echoing back the tag/value pairs obtained via an HTML <form> data entry page.
Practical Computer Language Recognition and Translation
Terence Parr Tue Jul 22, 2003 13:14
My next book, work in progress (haven't touched in a while), but you should read the "building translators by hand" chapter for sure if you are just getting started.
ANTLR: A Predicated-LL(k) Parser Generator
Terence Parr and Russell Quong Fri Jun 13, 2003 17:25
This article appeared in the Journal of Software Practice and Experience, Vol. 25(7), 789-810 (July 1995). It summarizes the features of ANTLR from the PCCTS 1.33 days and why they represent a major step forward in practical parsing technology. ANTLR's ease of use and strong language recognition capability has made it one of the most popular language tools around.
Compiler Construction with ANTLR and Java
Gary L. Schaps Fri Jun 13, 2003 17:23
A nice article by Gary about his experience using ANTLR to build a pattern language for an integrated circuit tester.
Symbolic Differentiation Part II
Terry Brugger Fri Jun 13, 2003 17:15
How to build the trees for the PolyParser.
Symbolic Differentiation Part I
Terry Brugger Fri Jun 13, 2003 17:14
This entry in the field guide presents the Tutorial from Terence's Book ported into ANTLR 2. It is written from my experience as a developer who was already familiar with Java and parsing. It assumes that you have a copy of Terence's Book, as I will refer directly to the pages therein.
ANTLR Meets Sed
Terence Parr Fri Jun 13, 2003 17:13
Making ANTLR filter/replace like UNIX sed tool.
Parsing Simple Data
Terence Parr Thu Jun 12, 2003 18:29
This leads you through the development of a simple parser for reading in name/age pairs.
Quick Start Guide
Terence Parr Thu Jun 12, 2003 18:25
Thisleads you through the development and execution of your first ANTLR parser and lexer.
1.33-to-2.20 Conversion Tips
Tom Nurkkala Thu Jun 12, 2003 18:05
I've been converting 1.33 grammars to 2.0 and thought I'd pass along the following tips that may help folks avoid some of the problems I've had doing it. I hope these tips help -- happy parsing!
Conversion of a C++ Parser from PCCTS to ANTLR
Jianguo Zuo, David Wigg, S. E. Black Thu Jun 12, 2003 17:59
These notes were produced by Jianguo Zuo who converted an original version (1995 1.2) of a C++ parser, cplusplus.g, file which ran under PCCTS 1.33 to run under ANTLR 2.7.1. This conversion was done as part of a project to produce output for another project. As all our embedded code was written in C++ the output from ANTLR was required in C++ so that our embedded code could remain in C++.
LL and LR Translator Need k>1 Lookahead
Terence Parr Thu Jun 12, 2003 11:05
Language translation is a harder and more important problem than language recognition. In particular, programmers implement translators not recognizers. Yet too often, translation is equated with the simpler task of syntactic parsing. This misconception coupled with computing limitations of past computers has led to the almost exclusive use of LR(1) and LL(1) in parser generators. We claim that use of k>1 lookahead can and should be available in practice, as it simplifies the translator development. We give several examples justifying our arguments.
Exactly 1800 Words on Languages and Parsing
Terence Parr Thu Jun 12, 2003 11:01
Excerpt from Language Translation Using PCCTS & C++ that provides parsing theory term definitions and illustrates the various parsing strategies.
Building Development Tools
Terence Parr with Greg Voss Tue Feb 11, 1997 12:00
A conversation with Greg Voss on building development tools.
ANTLR Workshop 97
Terence Parr Wed Jan 1, 1997 00:00
The 1997 ANTLR workshop Dr. T's Traveling Parsing Revival and Beer Tasting Festival held at Sun Microsystems.
Language Translation Using PCCTS and C++
Terence Parr Thu Aug 1, 1996 00:00
The book I did on PCCTS. More of a manual for older version of ANTLR (PCCTS), but has some useful sections. This book is out of print.
PCCTS Workshop 95
Terence Parr Sun Jan 1, 1995 00:00
The 1995 PCCTS workshop Dr. T's Traveling Parsing Revival and Beer Tasting Festival held at SGI I think.
An Overview of SORCERER: A Simple Tree-Parser Generator
Terence Parr Fri Apr 1, 1994 00:00
Describes SORCERER, the source to source translator generator I built to help solve my Fortran translation issues as a postdoctoral fellow. It evolved into ANTLR's tree parsers. :)
Adding Semantic and Syntactic Predicates to LL(k): pred-LL(k)
Terence Parr and Russell Quong Fri Apr 1, 1994 00:00
Discusses the definition of semantic and syntactic predicates for LL(k).
PCCTS Workshop 94
Terence Parr Sat Jan 1, 1994 00:00
The 1994 PCCTS workshop Dr. T's Traveling Parsing Revival and Beer Tasting Festival held at NeXT Computer.
Obtaining Practical Variants of LL(k) and LR(k) for k>1 by splitting the atomic k-Tuple
Terence Parr Thu Jul 1, 1993 10:00
Terence Parr's PhD Dissertation on Practical LL(k) and LR(k) for k>1 parsing that describes the theoretical principles behind the construction of ANTLR's parsers. Something dark and scary to read. According to Quinn Jackson, "This is probably one of the more readable theses I've come across, except maybe that of Dr. Francoise Balmas at University Paris-8."
Preserving Whitespace During Translation
Whitespace is ignored and discarded for most parsing and translation operations, however, what about translations that are only slight perturbations of the input? This field guide entry demonstrates how you can preserve whitespace during a nontrivial (i.e., cannot easily be done with awk/sed) translation using ANTLR's token streams.