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.

1 enum string def = "
2 Gram:
3     A <- 'a' B*
4     B <- 'b' / 'c'
5 ";
6 
7 mixin(grammar(def));
8 
9 ParseTree p = Gram("abcbccbcd");
  1. string grammar(string definition)
    string
    grammar
    (
    string definition
    )
  2. string grammar(ParseTree defAsParseTree)

Meta