in reply to Re: Perl6: Dynamic Grammars
in thread Perl6: Dynamic Grammars

Rubber Duck Debugging :)

Replies are listed 'Best First'.
Re^3: Perl6: Dynamic Grammars
by bduggan (Pilgrim) on Jun 06, 2016 at 00:19 UTC
    Another option would be to use meta programming, e.g. starting with
    grammar g { rule TOP { <bang> | <at> } rule bang { 'bang' '!' [<-[!]>*] '!' } } g.^add_method('at', rx { 'at' [\s*] '@' [<-[@]>*] '@' } ); # ... then do the above for each of the sigils g.^compose; say g.parse('bang !some text!'); say g.parse('at @some text@');