https://github.com/yglukhov/ddparser
Port of Dparser to D language
https://github.com/yglukhov/ddparser
Last synced: 6 months ago
JSON representation
Port of Dparser to D language
- Host: GitHub
- URL: https://github.com/yglukhov/ddparser
- Owner: yglukhov
- Created: 2014-07-21T18:34:20.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-11-13T12:06:13.000Z (almost 11 years ago)
- Last Synced: 2025-03-25T08:20:55.710Z (7 months ago)
- Language: C
- Homepage:
- Size: 814 KB
- Stars: 4
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ddparser
========[Dparser](http://dparser.sourceforge.net) port in [D language](http://dlang.org)
Dparser is a GLR parser, with lots of features:
- Runtime generation of parsing tables. Compile-time generation is work in progress.
- Handling of ambiguous grammars. Calls back to user code, when ambiguity can not be resolved automatically.
- Terminals are defined within the same grammar used for language syntax, by means of strings and regular expressions.
- Many more. Please, read the [official page](http://dparser.sourceforge.net).Usage example:
```d
Grammar g = new Grammar();
g
<< `EXPRESSION: EXPRESSION '+' EXPRESSION` << (c)
{
writeln("EXPRESSION: ", c[0], " + ", c[2]);
}<< ` | INT_LITERAL` << g.propagate
<< `INT_LITERAL: "[0-9]+"` << (c)
{
writeln("Parsed literal: ", c[0].stringValue);
}
;Parser p = new Parser();
if (p.setGrammar(g))
{
writeln("PARSE RESULT: ", p.parse("123 + 456"));
}
```