Sunday, April 23, 2023

Testing ANTLR4

ANTLR.org

ANTLR (ANother Tool for Language Recognition) is a powerful parser generator for reading, processing, executing, or translating structured text or binary files. It's widely used to build languages, tools, and frameworks. From a grammar, ANTLR generates a parser that can build and walk parse trees.

ANTLR Lab: learn, test, and experiment with ANTLR grammars online!

antlr/antlr4-lab: A client/server for trying out and learning about ANTLR


Download ANTLR

The latest version of ANTLR is 4.12.0, released February 19, 2023


download and use Java from Oracle, not from java.com


copy .jar to Java "lib" folder, and
add location of antlr jar file to java CLASSPATH env var

C:\Program Files\Java\jdk-20\lib\antlr-4.12.0-complete.jar;%CLASSPATH%;

antlr4/javascript-target.md at master · antlr/antlr4 · GitHub

for JavaScript examples to work, the version of antrl4 jar file and antlr4.js have to match.

to achieve this one way is to set fixed version of antlr4.js in node.js package.json file


ANTLR examples from Strumenta

The ANTLR Mega Tutorial

gabriele-tomassetti/antlr-mega-tutorial: This is the companion repository of the ANTLR Mega Tutorial, that will explain everything you need to know to use ANTLR.


ANTLR and the web: a simple example - Strumenta

ftomassetti/antlr-web-example


VS Code plugins

ANTLR4 grammar syntax support - Visual Studio Marketplace



No comments: