Antlr4 Versions Save

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.

4.5

9 years ago

Major Milestone Release

This release is primarily about the new JavaScript code generation target and the integration of a C# target derived from Sam Harwell's ANTLR project. Sam's is still available of course but we wanted a single tool that would generate Java, C#, Python2, Python3, and JavaScript. There are also a number of bug fixes in 4.5 as you can see below.

You need to regenerate your lexers and parsers using the latest version of the 4.5 Tool to use the 4.5 runtime.

Download Binaries

Download the ANTLR tool and all target runtimes at the antlr.org site.

The Java jars are OSGi compatible so you should be able to use them within Eclipse.

Runtime Libraries for Language Targets

  • Java is embedded with the tool, but is also available from maven-central (will be but you can get 4.5-SNAPSHOT right now until I figure out deploying.)
  • C# (zipped .dll) is a download from antlr.org. Might be in NuGet too in the future.
  • JavaScript is a download from antlr.org. Might also be registered as a npm package for node.js
  • Python2 and Python 3 are in PyPi
  • Sam Harwell's alternative C# target is available through NuGet. Note that this alternative target is distributed with a standalone copy of the ANTLR Tool, and only works with code generated by that standalone copy.

Documentation

Summary of Changes

You can view all issues closed for this release, all pull requests merged and all commits for this release.

Be aware that we no longer deploy a maven antlr4-annotations artifact and in fact we no longer use Java annotations in the Java runtime and so that code is disappeared.

Bug Fixes

Language Targets Info

As of 4.5, the standard distribution of ANTLR can generate code in the following languages:

In addition, the following languages are supported by standalone release(s) of the tool.

Also, Sam Harwell has an ANTLR 4 "Optimized" fork, which is currently consistent with ANTLR 4.4.

4.5-rc-2

9 years ago

This version has an important bug fix, #670, and a big update to the build system while we try to accommodate maven and its deployed mechanism.

Also be aware that we no longer deploy a maven antlr4-annotations artifact, which is only used at compile time for runtime and the ANTLR tool itself. If you use the runtime jars, you should not needed at all. If you need to compile/build, grab stuff from github.

4.5-rc-1

9 years ago

Major Milestone Release (release candidate)

This release is primarily about the new JavaScript code generation target and the integration of a C# target derived from Sam Harwell's ANTLR project. Sam's is still available of course but we wanted a single tool that would generate Java, C#, Python2, Python3, and JavaScript. There are also a number of bug fixes in 4.5 as you can see below.

We highly recommend that you regenerate your lexers and parsers using the latest version of the Tool.

Download Binaries

Download ANTLR jars at the antlr.org site.

Runtime Libraries for Language Targets

  • Java is embedded with the tool, but is also available from maven-central (will be)
  • C# (zipped .dll) is a download from antlr.org. Might be in NuGet too in the future.
  • JavaScript is a download from antlr.org. Might also be registered as a npm package for node.js
  • Python2 and Python 3 are in PyPi
  • C# (Sam Harwell's version) is available through NuGet. Note that this release is distributed with a standalone copy of the ANTLR Tool, and does not work with code generated by this combined distribution.

Documentation

Summary of Changes

You can view all issues closed for this release, all pull requests merged and all commits for this release.

Bug Fixes

IDE Support

We have not updated the IDE plugins for this prerelease.

Language Targets

As of 4.5, the standard distribution of ANTLR can generate code in the following languages:

In addition, the following languages are supported by standalone release(s) of the tool.

Also, Sam Harwell has an ANTLR 4 "Optimized" fork, which is currently consistent with ANTLR 4.4.

4.4

9 years ago

Major Milestone Release

ANTLR 4.4 is a major feature and minor bugfix update to ANTLR 4. The primary enhancement is the introduction of both Python2 and Python3 language targets, which you can access with -Dlanguage=Python2 from the ANTLR command line. For C#, please use Visual Studio plugin/tool that Sam Harwell has built.

Please note that tool error messages have been altered to remove unnecessary single quotes and we have added some more specific error messages.

This release includes a new build script called bild.py and was not build using maven. bild.py is a Python script I made that looks like a makefile and self bootstraps by pulling in the required bilder.py library from the net. See http://bildtool.org. On a unix box, just type "./bild.py all" to build antlr from source (if you are so inclined).

We highly recommend that you regenerate your lexers and parsers using the latest version of the Tool.

Download Binaries

Download ANTLR jars at the antlr.org site.

Documentation

Summary of Changes

You can view all issues closed for this release here, and all commits for this release here.

Bug Fixes

IDE Support

Project Release which Supports ANTLR 4.4
ANTLRWorks 2
IntelliJ Plugin 1.5
Eclipse Plugin
Visual Studio Extension 1.2.1

Alternate Language Targets

As of 4.4, ANTLR can generate code in the following languages:

Also, Sam Harwell has an ANTLR 4 "Optimized" fork, which is currently consistent with ANTLR 4.3.

4.3

9 years ago

Major Milestone Release

ANTLR 4.3 is a major feature and bugfix update to ANTLR 4. For most users upgrading from ANTLR 4.2, 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.

Download Binaries

Download ANTLR jars at the antlr.org site.

Documentation

Summary of Changes

You can view all issues closed for this release here, and all commits for this release here.

Features

  • Parser profiler (#583)
  • Tool/Runtime version mismatch detection (#572, #601, #634, #635)

Improvements

  • Improved support for additional targets (#554, #566, #569, #609, #610)
  • Add clearDFA() method to easily clear the DFA cache (#584)
  • Improved documentation

Bug Fixes

  • Fix issue with tokens named ATN (#561)
  • Fix generated JavaDoc for listener and visitor methods for context objects created by labeled alternatives in a rule (#543)
  • Fix errors in support for parsing off-channel tokens (#544, #622, #626)
  • Fix references that alias the enclosing rule name (#571)
  • Fix issues with use of <assoc=right> (#542)
  • Fix issues with unsupported and/or ignored semantic predicates (#588, #590)
  • Allow multiple actions and/or predicates to appear at the end of alternatives in a left-recursive rule (#625)
  • Fix bugs in infrequently used IntervalSet code (#623)
  • Fix issues with file encoding handling (#563, #618)

Breaking Changes

  • Within an embedded action or semantic predicate, references to the enclosing rule can no longer be written as $ruleName. Instead, use the special symbol $ctx to refer to the enclosing rule. Parsers already generated from grammars prior to this change are not affected, but the grammar will need to be updated prior to generating code with ANTLR 4.3. This change was required as part of correcting #571.
  • IntervalSet.getMinElement now returns the first element, even if that element is negative. Code which relied on this method to return a non-negative value even if the set contained negative values will need to be updated.

The following tables list several related projects, along with the version number corresponding to this release. The tables will be updated as each of the projects release updates to support this release of ANTLR 4.

IDE Support

Project Release which Supports ANTLR 4.3
ANTLRWorks 2
IntelliJ Plugin
Eclipse Plugin
Visual Studio Extension 1.2.1

Alternate Language Targets

Project Release which Supports ANTLR 4.3
ANTLR 4 "Optimized" fork 4.3-opt
C# Target 4.3

4.2.2

10 years ago

Minor Bug Fix Release

ANTLR 4.2.2 is a minor bugfix update to ANTLR 4. This update is source- and binary-compatible with ANTLR 4.2 for virtually all users (see the Breaking Changes section at the end). Users updating from earlier versions are encouraged to read the release notes for ANTLR 4.2.

Documentation

Summary of Changes

You can view all issues closed for this release here, and all commits for this release here.

Bug Fixes

  • Improve the handling of grammars containing multiple explicit references to EOF (#531, #534, #537, #539)
  • Improve the ability of generated parsers to report localized errors in the presence of semantic predicates (#529, #530, #533, parrt/antlr4#134, #538)
  • Other minor fixes and cleanup (#528, #532, #538, #540)

Breaking Changes

The signature of the following methods changed to support the proper handling of grammars with multiple explicit references to EOF. These methods are rarely, if ever, overridden in client applications.

  • LexerATNSimulator.closure
  • LexerATNSimulator.getEpsilonTarget
  • ParserATNSimulator.closure
  • ParserATNSimulator.closureCheckingStopState
  • ParserATNSimulator.closure_
  • ParserATNSimulator.getEpsilonTarget

The following tables list several related projects, along with the version number corresponding to this release. The tables will be updated as each of the projects release updates to support this release of ANTLR 4.

IDE Support

Project Release which Supports ANTLR 4.2.2
ANTLRWorks 2 2.2.2
IntelliJ Plugin 1.1
Eclipse Plugin 0.3.0
Visual Studio Extension 1.2.1

Alternate Language Targets

Project Release which Supports ANTLR 4.2.2
ANTLR 4 "Optimized" fork 4.2.2-opt
C# Target 4.2.2-alpha001

4.2.1

10 years ago

Minor Bug Fix Release

ANTLR 4.2.1 is a minor bugfix update to ANTLR 4. This update is source- and binary-compatible with ANTLR 4.2. Users updating from earlier versions are encouraged to read the release notes for ANTLR 4.2.

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.

Bug Fixes

  • Fix the ParserRuleContext which is returned by the parser interpreter when parsing starts with a left-recursive rule (#461)
  • Fix the accessor methods generated for rules where multiple alternatives use the same label (#433)
  • Add new warning and error messages to help users (#472, #489, #500)
  • Fix lexer action execution in the middle of rules (#469)
  • Fix bug in adaptivePredict for certain left recursive rules (#509)
  • Other smaller fixes (#474, #495)

4.2

10 years ago

Major Milestone 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.

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

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) Note: This feature is only available for Maven users; not as part of the standalone ANTLR downloads.
  • 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

4.2-SNAPSHOT

10 years ago

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

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

4.1

10 years ago

Feature and Bug Fix Release (minor breaking changes)

You can view all issues closed for this release here, and all commits for this release here.

New Features

This list may be incomplete, and does not include ordinary bug fixes.

  • Additional static analysis to report warnings and errors in grammars.
  • Improved support for other targets (currently Java and C# targets are available).
  • Added parse tree JTree pane and Export to PNG feature to parse tree viewer.
  • Improved runtime API documentation.
  • Improved parsing performance.
  • Support \uFFFF in lexers.
  • Updated Java grammars to support Java 7 syntax, including full support for Unicode escape sequences.

Breaking Changes

This list may be incomplete

The following changes are likely to have a significant impact on user code.

  • The serialized ATN representation has changed and is not backwards compatible. All parsers must be regenerated before they can be used with the ANTLR 4.1 runtime.

The following changes are not likely to break user code (infrequently used features or code).

  • Changed the formatting of the default error messages printed to console (could affect tools which parse this raw output).
  • Remove the ParserRuleContext.altNum field.
  • String literals and lexer character sets cannot span multiple lines in the grammar. Use the escape characters \n and/or \r to include newline characters in a literal or set.
  • The Pair and Triple classes in the runtime are now immutable, and Triple does not extend Pair.
  • If you extended the ANTLRErrorStrategy interface (or one of its derived classes), be aware of significant changes to those files.
  • If you extended LexerATNSimulator or ParserATNSimulator, be aware of significant changes in those classes.
  • Removed ParserInterpreter.predictATN.
  • If you use code to clear the cached DFA, be aware that the invariants have changed and the previous code will result in an exception with ANTLR 4.1.
    • Old method (ANTLR 4.0)

        Arrays.fill(parser.getInterpreter().decisionToDFA, null);
      
    • New method (ANTLR 4.1)

        ATN atn = parser.getATN();
        for (int i = 0; i < parser.getInterpreter().decisionToDFA.length; i++) {
            parser.getInterpreter().decisionToDFA[i] = new DFA(atn.getDecisionState(i), i);
        }