The Great New ANTLR 4.8

It has  been more than two years since the last major release of ANTLR, now version 4.8 is ready. ANTLR is a mature and well-tested project, but this release still manages to bring a new target, a fix for the C# packet, improvement on the compilation of the C++ runtime and a few fixes.

New Target

The big news of this release is the new target for ANTLR: PHP. This is good news for ANTLR and great news for PHP, which has plenty of support for web-related stuff but usually lacks in good libraries for this kind of work. Now, PHP has a bad reputation, which was completely warranted a few years ago, but since the release of PHP 7 is no more true. It is still a very popular language and now a reliable choice. It also powers the most used CMS: WordPress. Think about it: now you could easily build a parsing plugin for WordPress. We are not saying that this is a good idea, but now you could do it. We all have to thank Marcos Passos for this.

C# Package

There is a fix for the C# package on Nuget to fix an assembly signature problem. This is in itself a small (although important) fix, however this is a good chance to talk about an issue with the C# Nuget packages. The people that follows ANTLR on C# knows that there are actually two ANTLR packages for C#: one is the standard, the other one is a C#-optimized version. You can read more about why that is in the C# Setup section of our ANTLR Mega Tutorial. The old C#-optimized version is still more popular, but you should really opt for the new ANTLR4 standard, unless you really care just about C#. That is because the standard version is more updated and it is completely in sync with the official ANTLR release: spread the word!

Improvement in the Compilation of the C++ Runtime

There is also an improvement regarding the development of the C++ target on Windows. Now the Visual Studio project to build the C++ target uses VS2017/2019 instead of VS2013/2015. This is a small change, but working with a real C++ project involve dealing with all the different versions of the C++ language, static and dynamic libraries, 32 and 64bit, debug and release versions. So, you may end up forced to build the target yourself to make a project compile, we know that by experience.

There is also now support for using Emscripten to compile the C++ runtime, so that is also good news.

Updates to the Swift Runtime

The last important news is the upgrade of the Swift runtime to support version 5 of Swift. Luckily the new version of Swift did not introduce big breaking changes to the language (as has happened in the past). So this is an important update and a no-brainer change.

Summary

ANTLR is the best tool to build parsers out there: it is well-tested, reliable enough to be used in an enterprise setting and usable enough so that you actually want to work with it. This release offers a few fixes and maintenance work. The big change however is the new target; now with one ANTLR grammar you can build parsers in:

  • Java
  • C#
  • C++
  • JavaScript
  • Python 2 and 3
  • Go
  • Swift
  • PHP
  • Kotlin (with our experimental target)

That is a lot of languages, which means that you can learn the technology once and use it for all your parser needs.

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

Powered by ConvertKit

Do You Need a Parser?

We can design parsers for new languages, or rewrite parsers for existing languages built in house.

On top of parsers we can then help building interpreters, compilers, code generators, documentation generators, or translators (code converters) to other languages.