>> 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. But how to associate actions with a rule, in that case? I mean, some rules will have actions, some not. In my case, a parse tree is automatically generated (indeed, it's almost the only thing returned by a parse call, that with recognized string and named captures). I have some additional syntax to 'drop' a node ans such, similar to what you proposed a few posts ago.