Using ANTLR like a professional.
A video course that takes you from your first grammar to a parser you can put into production—written by people who build parsers for a living.
Sixteen lessons and three and a half hours of video in the Standard edition; twenty lessons and four hours in the Professional edition, which adds the performance material and our best-practice guide. Source code in Python, JavaScript and C#, five commented example grammars, and a manual of more than fifty pages.
- Lexer rules and parser rules blur together
- Expressions and operator precedence fight back
- Indentation-sensitive input has no obvious answer
- The grammar works, then a real file breaks it
- The parse tree is not the shape your tool needs
Each of these has a known solution. The course is the shortest route to all of them.
Why ANTLR
ANTLR is a parser generator: you write a grammar, it produces a lexer and a parser in your target language. It handles rich grammars and gives you both listeners and visitors for walking the result, which makes it a reasonable default for programming languages and for domain-specific languages alike.
One grammar, many targets
ANTLR generates parsers for Java, C#, Python, JavaScript, TypeScript, Go, C++, Swift, PHP and Dart. Strumenta maintains the Kotlin target, which produces a multiplatform library from a single grammar.
Tooling that shows you the tree
Visual parse-tree inspection and grammar testing come with the toolchain, and there are plugins for IntelliJ IDEA and VS Code with syntax highlighting, error checking and live grammar testing.
Used in production, widely
ANTLR sits underneath open-source tooling and commercial systems across many industries, which means the answers to hard grammar questions usually already exist somewhere.
What you will be able to do
By the end of the course you should be able to take an unfamiliar input format, write a grammar for it, test that grammar, handle its errors, and turn the parse tree into a structure your own tool can work with.
- Build a complete parser with ANTLR. From an empty grammar file to a working parser that handles real input and reports errors usefully.
- Design and test grammars deliberately. How to write grammars that stay maintainable, and how to test them against real examples instead of guessing.
- Work with parse trees. Navigating and transforming them with listeners and visitors, and converting them into abstract syntax trees that suit your tool rather than the grammar.
- Handle the hard cases. Complex expressions, indentation blocks of the kind Python uses, multiple languages in one document, and the constructs that appear once you point a grammar at a real programming language.
What is in the course
Everything you need to build a parser
$329one-time
- 16 lessons, 3 hours 30 minutes of video
- Full source code in Python, JavaScript and C#
- A manual of more than 50 pages with cheatsheets
- 5 example grammars, commented
- A short guide to getting started with grun
- Subtitles and transcripts for every lesson
- Access to the reserved area of the Strumenta community
Plus performance and our own house rules
$679one-time
- 20 lessons, 4 hours of video
- Everything in the Standard edition
- Four extra lessons on transforming complex parse trees and on parser performance
- The ANTLR best-practice guide: the principles and patterns we use, and the ones we avoid, from our own parser work
Lesson by lesson
Lessons 1 to 16 are in both editions. Lessons 17 to 20 are Professional only.
- 01Introduction to parsers. What parsers are, what they are good for, and the parts one is made of.
- 02Introduction to ANTLR. Setting ANTLR up and using the command-line tools.
- 03Grammar. The format of a grammar and its elements, and how to write lexer and parser rules and their typical patterns.
- 04Listeners and visitors. What they are and how to use them to handle the result of parsing.
- 05Errors. Reporting errors and dealing with them.
- 06Testing. How to test grammars, listeners and visitors.
- 07Actions. The more advanced, and less clean, way to work with the results of parsing.
- 08Semantic predicates. What they are and when to reach for them.
- 09How to deal with expressions. The old way of handling expressions and the newer, simpler one.
- 10Lexical modes. Parsing documents that contain more than one language.
- 11Tips and tricks. A set of smaller techniques that come up repeatedly.
- 12Parsing real programming languages. The problems you will hit, and how to solve them.
- 13Designing a grammar. How to design one from nothing, and how to work from an existing grammar.
- 14What comes next. The other pieces of a compiler and how they attach to ANTLR.
- 15From parse tree to abstract syntax tree. Understanding the transformation and deciding what to transform.
- 16Creating an AST. A full worked example of turning a parse tree into an AST.
- 17Transforming complex parse trees. Handling trees that do not map cleanly onto the structure you want.Professional
- 18Setting up for performance. ANTLR setup and the grammar mistakes to avoid.Professional
- 19Changes to improve performance. Grammar-rule patterns to use, and the ones to avoid.Professional
- 20Tweaking ANTLR to improve performance. Getting more out of the same grammar.Professional
What people have said
“Federico Tomassetti has created an awesome ANTLR video course if you are interested. It costs money but could be worth it for you if you want to get up to speed quickly.”
“I just finished watching the ‘Using ANTLR Like A Professional’ video course, and I now know how to rewrite our existing parsers!”
Who teaches it, and what happens if it is not for you
- We do this for a living. Strumenta builds parsers and transpilers for clients on five continents, from Fortune 100 companies to small teams. The course is the material we wish we had been handed when we started.
- Refunds. If the course is not what you needed, ask and you get 100% back, with no explanation required, within six months of purchase.
- If you would rather not build it yourself. We license parsers we have already built and we build custom ones. See license our parsers and custom parsers.
- Going further than the course. If you need help applying this to a specific language or project, we also do one-to-one consulting. Tell us the situation and we will say whether it is worth an hour or a project.
Write the grammar you have been putting off.
Start with the Standard edition if you want a working parser. Take the Professional edition if you already know you will care about performance and about the shape of the tree.