Skip to content

Instantly share code, notes, and snippets.

Created March 15, 2016 20:59
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/3a768052cdfd807e6d00 to your computer and use it in GitHub Desktop.
Save anonymous/3a768052cdfd807e6d00 to your computer and use it in GitHub Desktop.
grammar BUU {
token TOP { <abc>+ };
token abc { 'a' <bc>* };
token bc { [ 'b' <c>* ]+ }
token c { 'c' };
};
class BuuAbc0 {
method TOP($/) { make $/; }
method abc($/) { make $/; }
method bc($/) { make $/; }
method c($/) { make ~$/; }
};
my $r = BUU.parse( "abcabccabbccaababc", :actions( BuuAbc0 ) );
#say $r.ast;
say $r;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment