grammar

Generate a parser from a PEG definition. The parser is a string containing D code, to be mixed in or written in a file.

enum string def = "
Gram:
    A <- 'a' B*
    B <- 'b' / 'c'
";

mixin(grammar(def));

ParseTree p = Gram("abcbccbcd");
  1. string grammar(string definition)
    string
    grammar
    (
    string definition
    )
  2. string grammar(ParseTree defAsParseTree)

Meta