Skip to content

Instantly share code, notes, and snippets.

@FROGGS
Last active December 20, 2015 02:29
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 FROGGS/c7bd14c0da153c88f058 to your computer and use it in GitHub Desktop.
Save FROGGS/c7bd14c0da153c88f058 to your computer and use it in GitHub Desktop.

nqp@parrot

grammar G { token TOP{ <a>+ }; token a{ <b>|<c> }; token b{ "x" }; token c{ \d } };
class C { method a($/){ say("ohh") if $<b> } };
say(G.parse("x123", :actions(C.new)))
ohh
x123

on MoarVM:

grammar G { token TOP{ <a>+ }; token a{ <b>|<c> }; token b{ "x" }; token c{ \d } };
class C { method a($/){ say("ohh") if $<b> } };
say(G.parse("x123", :actions(C.new)))
ohh
ohh
ohh
ohh
x123
@FROGGS
Copy link
Author

FROGGS commented Jul 24, 2013

fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment