After almost a year since the last major release, there is a new ANTLR version: 4.6. There are many news: new targets, better perfomance, better error handling and several improvements in the development of ANTLR itself.
Major performance improvement
One of the greatest addition in ANTLR 4 was the support for left-recursive expression, that is to say expressions that have one or more alternatives that referenced themselves. This greatly simplified grammar rules needed to support expressions, but there were were cases of nonterminating parses for very large expressions. This happened because of a problem with the parsing engine, due to an ambiguity between two choices. Both lead to a valid parse, but one was much slower than the other. The problem was discovered by Sam Harwell, one of the key contributors to ANTLR.
Error handling and messages
There have been improvements in error handling of some cases: related to LL(1) decisions, matching set of tokens mistakenly considered resynchronization tokens and the occasional non inclusion of error nodes for single token. Furthermore there are better error messages, for instance in the case of rules conflicting with symbols in the generated code in the specified target language.
Improvement in the development of ANTLR
Other important news are several improvements related to the development of ANTLR itself. While this don’t directly affect you, as a user, they may make easier for you to contribute to the project, to study how a big Java project works or even inspire you to improve your own opensource project. These range from betterment to the build system and the maven plug-in to a completely rewritten unit test mechanism. Also it’s useful to be aware that now the build environment requires ANTLR Java 7/JDK 1.7, a change spurred by the Swift target.
ANTLR is a precious tool for many people interested in languages. This release proves once again that ANTLR is here to stay and it keeps evolving. This release is a bit special because of the significant number of meaningful changes. I can see this projecting more enthusiasm in the ANTLR community and I am looking forward to see more great things happening in this area.
Download the guide with 68 resources on Creating Programming Languages
Receive the guide to your inbox to read it on all your devices when you have time