antlr / antlr4

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files.
http://antlr.org
BSD 3-Clause "New" or "Revised" License
16.73k stars 3.24k forks source link

NuGet releases / MSBuild Targets? #3960

Open fowl2 opened 1 year ago

fowl2 commented 1 year ago

It seems like some of the official NuGet packages have been stuck on version 4.6.6 (since 2018) - Antlr4, Antlr4.Runtime, Antlr4.CodeGenerator.

Antlr4.Runtime.Standard has made it to 4.11.1, but it doesn't seem to include the MSBuild targets.

Are there plans to release updated versions? Should these be considered deprecated? What's the recommended way to generate code from a MSBuild project?

fowl2 commented 1 year ago

Apologies, it turns out I was reading this readme from an old fork, not the current one which seems not to be linked[1].

Am I correct in thinking that Java is now required again?

Should the above NuGet packages be deprecated?


[1] well, a broken link

ericvergnaud commented 1 year ago

Hi,The only official NuGet package is AntLR4.runtime’.standard.Other packages emanate from visiontunnellabs and not maintained by this group.EricEnvoyé de mon iPhoneLe 15 nov. 2022 à 03:45, James May @.***> a écrit : It seems like some of the official NuGet packages have been stuck on version 4.6.6 (since 2018) - Antlr4, Antlr4.Runtime, Antlr4.CodeGenerator. Antlr4.Runtime.Standard has made it to 4.11.1, but it doesn't seem to include the MSBuild targets. Are there plans to release updated versions? Should these be considered deprecated? What's the recommended way to generate code from a MSBuild project?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

kaby76 commented 1 year ago

Antlr4cs is an old fork of github.com/antlr/antlr4. The packages from the old fork are:

You shouldn't use these packages because the fork is years behind the current Antlr4 release. Some of the grammars in grammars-v4 require the current package Antlr4.Runtime.Standard, which has had many bug fixes and extensions since the fork. And, although the code says it's "optimized", my tests show statistically most of the time the Antlr4.Runtime.Standard package is actually faster that the old fork.

Instead, use Antlr4.Runtime.Standard along with Antlr4BuildTasks. Antlr4.Runtime.Standard is the current version of the runtime for C#. And, while it requires Java, you should NOT download the Antlr4 tool .jar nor Java!

The best way to use the current runtime using dotnet build or msbuild is to use my Nuget package Antlr4BuildTasks. This is a fork of Harwell's Antlr4BuildTasks code. I've spent years cleaning up the build package of the code, extending it to work against the "official" Antlr4.Runtime.Standard package. Just add a <PackageReference> to Antlr4.Runtime.Standard (what ever version), and <PackageReference> to Antlr4BuildTasks version=12.1. Follow the instructions at the readme.md.

But, if you insist on using Java and the Antlr4 Tool jar outside a build, you should use the antlr4 tool in antlr4-tools.

Both tools I mention download a copy of the Java Runtime Environment (JRE), and the Antlr4 Tool Jar so you never need to do that manually.