Pegged, a Parsing Expression Grammar (PEG) generator in D
Philippe Sigaud
philippe.sigaud at gmail.com
Sat Mar 10 23:35:45 PST 2012
On Sun, Mar 11, 2012 at 08:26, Andrei Alexandrescu
<SeeWebsiteForEmail at erdani.org> wrote:
> I, too, think this is very significant work! Suggestion for Philippe:
> instead of this:
>
>
> enum PEGCode = grammarCode!(
> "Grammar <- S Definition+ EOI"
> ,"Definition <- RuleName Arrow Expression"
> ,"RuleName <- Identifier>(ParamList?)"
> ,"Expression <- Sequence (OR Sequence)*"
> );
>
> how about this:
>
> enum PEGCode = grammarCode!("
> Grammar <- S Definition+ EOI;
>
> Definition <- RuleName Arrow Expression;
> RuleName <- Identifier>(ParamList?);
> Expression <- Sequence (OR Sequence)*;
> ");
>
> Splitting on ";" is trivial and makes client code considerably easier to
> play with.
It's already implemented! No need for ';'
The docs are up to date, the internal code also. It's only an old
bootstrapping file that Andrej cited that still contains multi-string
definitions. I'll correct that, as that means I didn"t push dogfooding
far enough.
Now, just use one string:
"Grammar <- ...
Definition <- ...
"
More information about the Digitalmars-d-announce
mailing list