Major Milestone Release (Preview Release)
ANTLR 4.2 is a major feature and bugfix update to ANTLR 4. For most users upgrading from ANTLR 4.1, this is a source- and binary-compatible update. However, to maximize the benefits provided by the update, we highly recommend that you regenerate your lexers and parsers using the latest version of the Tool.
Prerelease Library
Download the pre-release jar for non-maven users.
The current prerelease build of ANTLR 4.2 is available through Sonatype's Maven snapshot repository. To enable your Maven builds to use the snapshot releases, include the following in your projects pom.xml
or in your system ~/.m2/settings.xml
.
<profiles>
<profile>
<id>allow-snapshots</id>
<activation><activeByDefault>true</activeByDefault></activation>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases><enabled>false</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>
</profiles>
With the snapshot repository enabled, you can reference the ANTLR 4 runtime with the following:
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr4-runtime</artifactId>
<version>4.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
Documentation
Please see the latest release for links to the current documentation.
Summary of Changes
You can view all issues closed for this release here, and all commits for this release here.
Features
- XPath-like syntax for selecting parse tree nodes
- Parse tree pattern matching using concrete syntax
LexerInterpreter
andParserInterpreter
are much more powerful and now part of the runtime library (details)
Improvements
- Improved left-recursion elimination algorithm in the Tool (#268, #303, #313, #314, #355)
- Substantial performance improvements for grammars containing left-recursive rules (#97, #192, #300, #400, #401)
- antlr4-maven-plugin now prints proper error messages, and is now compatible with Eclipse m2e out-of-the-box (#319, #342)
- A new annotation processor verifies correct use of
@NotNull
and@Nullable
at compile time, and is available through Maven separately from the rest of ANTLR 4 in the new antlr4-annotations artifact (#434, #435) - Initial support for Java 8 (#337, #430)
- The Tool supports grammar files in UTF-8 encoding with a byte order mark, a common default for text editors on Windows systems (#175)
Bug Fixes
- Many other bug fixes