grammars-v4
grammars-v4 copied to clipboard
Enable testing of grammars with Antlr4ng
This PR updates the grammars and build to test using the Typescript tool and runtime Antlr4ng for certain Antlr4 grammars. The target Antlr4ng is added to the grammar's desc.xml where the target works.
Antlr4ng is @mike-lischke 's updated TypeScript target, improving on many issues with the Antlr4 TypeScript target version 4.13.1. The reason it is added is because there will likely not be any further releases of Antlr4. In fact, for grammars that have TypeScript target-specific support code, Antlr 4.13.1 TypeScript runtime does not work with newer versions of tsc/Node because the generated parser and lexer cannot run (it cannot find the compiled base class files). The only hope is to use Antlr4ng.
This PR made the following changes.
- Installed Node 21.7.1 for all OSes for the CI workflow. This is required to run on Mac (dyld[15293]: Library not loaded: '/usr/local/opt/icu4c/lib/libicui18n.73.dylib'). In addition, I saw a performance gain with the newer node, but I don't see the gain here in the Github Actions.
- Added Antlr4ng templates for trgen.
- Updated the CSharp targets with net8.0.
- Fixed a problem with "clean.sh" in templates. The Antlr .jar is used to tell what files are generated and what should be removed. Note, this script is never used in testing.
- Added in
Antlr4nginto<targets>sections in desc.xml. This tells trgen that the grammar works for Antlr4ng.