https://github.com/funkwerk/antlr-d
Moved
https://github.com/funkwerk/antlr-d
antlr4 dlang
Last synced: 5 days ago
JSON representation
Moved
- Host: GitHub
- URL: https://github.com/funkwerk/antlr-d
- Owner: funkwerk
- License: other
- Created: 2018-05-22T05:46:58.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2021-05-12T21:32:03.000Z (over 4 years ago)
- Last Synced: 2025-02-10T05:45:02.704Z (8 months ago)
- Topics: antlr4, dlang
- Language: D
- Homepage: https://github.com/funkwerk-mobility/antlr-d
- Size: 92.4 MB
- Stars: 12
- Watchers: 15
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# ANTRLR D Target
The ANTLR D Target represents an full featured and tested port of ANTLR 4.
This covers the runtime library, the tool to translate the syntax into D code and the tests for the runtime library.
See also [ANTLR version 4.9.2](http://www.antlr.org/).Like other language ports, this D runtime library uses UTF-8.
## 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 ANTLR D-runtime library in lib/libantlr-d.a
4. The ANTLR tool for D will be generated by **make build_examples**
(**./build.ps1 build_examples** on windows)
in build/antlr4-4.9.2/tool/target/antlr4-4.9.2-complete.jarConsider providing a shortcut to make it easy to use ANTLR.
For example, define an alias:alias antlr4='java -jar path/to/antlr-d/build/antlr4-4.9.2/tool/target/antlr4-4.9.2-complete.jar'
### Dependencies
#### ANTLR tool
- java 1.8
- maven
- 7-Zip (Only on windows)## Examples
Check out the two simple but complete examples:
1. [Building a Calculator Using a Listener]
2. [Building a Calculator Using a Visitor]## Extension versus other ANTLR runtime versions
The data type to store text is [Variant](https://dlang.org/phobos/std_variant.html).
This is handy for the rewriting feature on an indent-based syntax like Python.
In this case we need a structure representing the text as well as the number of indents.[building a calculator using a listener]: example/listener/README.md
[building a calculator using a visitor]: example/visitor/README.md