Created
September 4, 2012 21:39
-
-
Save gfldex/3626896 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use v6; | |
my $s1 = 'AA foo; BB baz; AA bar;'; | |
my $s2 = 'AA buzz;'; | |
grammar G { | |
rule TOP { [ [ <ta> | <tb> ] <.ws> ]+ } | |
rule ta { 'AA' <name>';' { say $/<name>.Str; } } | |
rule tb { 'BB' <name>';' { G.parse($s2); say $/<name>.Str; } } | |
rule name { \w+ } | |
} | |
say ?G.parse($s1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment