Lexer and parser generators using CTFE
john at neggie.net
Sun May 27 14:13:43 PDT 2012
On Thursday, 1 March 2012 at 15:10:36 UTC, Philippe Sigaud wrote:
>>> mixin(Grammar!("Doc <- Node*"
>>> "Node <- OpeningTag (Text / Node)* ClosingTag", NodeAction,
>>> "OpeningTag <- '<' Identifier '>'", OpeningAction,
>>> "ClosingTag <- `</` Identifier '>'", ClosingAction,
>>> "Text <- (!(OpeningTag / ClosingTag) _)+"));
>> That looks about right, but still has a fair amount of noise.
>> I think the
> approach of putting the entire grammar in one string is best.
> Yes, using one string is indeed better. That won't be too
> difficult to code.
I'm wondering if people have seen LPeg. It's a Lua library, but
the design is interesting in that patterns are first class
objects which can be composed with operator overloading.
More information about the Digitalmars-d