Skip to content

Latest commit

 

History

History
 
 

parser-generation

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

How The Parser was Generated

The Expression Template syntax is defined in ABNF grammar. There is far better Java support for ANTLR grammar so first we convert the ABNF file to ANTLR.

Convert ABNF to ANTLR

Paste the contents of the ABNF file into the following webpage and hit Translate http://www.robertpinchbeck.com/abnf_to_antlr/

The resulting ANTLR grammar should be saved as a file named 'ExpressionTemplate.txt' Add the following as the first line of the ExpressionTemplate.txt file:

grammar ExpressionTemplate;

Generate the ANTLR Parser

Download the ANTLR java program from http://www.antlr.org/download/antlr-4.5.3-complete.jar

Use the program to generate the Expression Template parser:

java -jar antlr-4.5.3-complete.jar ExpressionTemplate.txt -o parser-files

The parser java source files will be generated in a directory named parser-files.