Skip to content

Instantly share code, notes, and snippets.

Created September 27, 2011 16:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1245559 to your computer and use it in GitHub Desktop.
Save anonymous/1245559 to your computer and use it in GitHub Desktop.
pmichaud@kiwi:~/p6/nom$ cat t.p6
grammar ABC {
regex TOP { <a> <b> <c> }
regex a { 'a' }
regex b { 'b' }
regex c { 'c' }
}
class ABCActions {
method b($match) { say 'matched b' }
}
my $match = ABC.parse('abc', :actions(ABCActions));
say $match;
pmichaud@kiwi:~/p6/nom$ ./perl6 t.p6
matched b
abc
pmichaud@kiwi:~/p6/nom$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment