Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
antlr4
codegen
doc/examples
model
source/antlr/v4/runtime
test
unittest
.gitignore
LICENSE.txt
Makefile
README.md
build.ps1
dub.json

README.md

Antlr4DTarget

The D runtime library for ANTLR 4, mainly an adaption of original Java runtime library.

This Software is under development but tested on different grammars of ANTLR version 4.7.2 yet.

Install

  1. Download or clone the package
  2. Change directory to the root of the package and call dub.
  3. You will find the generated ATLR D runtime library in lib/libantlr-d.a
  4. The ANTLR tool for D will generated by make build_examples (./build.ps1 build_examples on windows)
    in build/antlr4-4.7.2/tool/target/antlr4-4.7.2-complete.jar

Dependencies

ANTLR tool

  • java 1.8
  • maven
  • 7-Zip (Only on windows)

Example

Put the

grammar Expr;		
prog:	(expr NEWLINE)* ;
expr:	expr ('*'|'/') expr
    |	expr ('+'|'-') expr
    |	INT
    |	'(' expr ')'
    ;
NEWLINE : [\r\n]+ ;
INT : [0-9]+ ;

in the file Expr.g4.

Now call

java -jar -Dlanguage=D build/antlr4-4.7.2/tool/target/antlr4-4.7.2-complete.jar Expr.g4

and the correspondig Lexer, Parser and Listener D-Source files are generated.

Restrictions

  • UTF-16 support not finished
You can’t perform that action at this time.