Skip to content

Latest commit

 

History

History
30 lines (19 loc) · 1.01 KB

ANTLR.md

File metadata and controls

30 lines (19 loc) · 1.01 KB

ANTLR

grule-rule-engine is heavily using ANTLR4 lexer/parser to parse GRL rule. The parser .go files were generated by ANTLR4 tools program.

Download ANTLR4 tools

The latest version can be downloaded here (antlr-4.9.2-complete.jar) Or you can always go to ANTLR4 download page

Download the .jar file and place it somewhere a directory.

Yes, you need Java for this. You can download java from Oracle's Java Download Page. Install java and you're ready to work with ANTLR4.

Making ANTLR alias.

alias antlr='java -jar /path/to/downloaded/antlr-4.9.2-complete.jar'

Executing ANTLR

To build ANTLR4's golang listener or visitor, go to the directory where you have your antlr4 grammar .g4 file. And then execute the following command.

antlr -Dlanguage=Go -o parser -package grulev3 -lib . -listener -visitor grulev3.g4