ddparser ~master

D language port for dparser


To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:

ddparser

Dparser port in D language

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.

Usage example:

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"));
}
Authors:
  • yglukhov
Dependencies:
none
Versions:
0.0.1 2014-Oct-14
~master 2014-Nov-13
Show all 2 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 227 downloads total

Score:
1.2
Short URL:
ddparser.dub.pm