Skip to content

Instantly share code, notes, and snippets.

Created September 27, 2011 15:45
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/1245430 to your computer and use it in GitHub Desktop.
Save anonymous/1245430 to your computer and use it in GitHub Desktop.
pmichaud@kiwi:~/p6/nqp$ cat t.nqp
grammar ABC {
regex TOP { <a> <b> <c> }
regex a { 'a' }
regex b { 'b' }
regex c { 'c' }
}
class ABCActions {
method b($/) { nqp::say('matched b') }
}
nqp::say(ABC.WHAT);
my $match := ABC.parse('abc', :actions(ABCActions));
nqp::say($match);
pmichaud@kiwi:~/p6/nqp$ ./nqpq t.nqp
ABC()
matched b
abc
pmichaud@kiwi:~/p6/nqp$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment