Skip to content

Instantly share code, notes, and snippets.

@TimToady
Created May 19, 2013 05:31
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 TimToady/5606798 to your computer and use it in GitHub Desktop.
Save TimToady/5606798 to your computer and use it in GitHub Desktop.
grammar Bug {
token TOP { <foo> \s* <bar($<foo>.ast)> } # putting {} after \s* makes it work
token foo { 'foo' { make 42 } }
token bar($x) { 'bar' { make $x+1 } }
}
my $p = Bug.parse('foo bar');
say $p<bar>.ast;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment