-
-
Save FROGGS/8c9556cf97fb301f8f84 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v6; | |
grammar BUU { | |
token TOP { <abc>+ }; | |
token abc { ('a') <bc>* }; | |
token bc { [ ('b') <c>* ]+ } | |
token c { 'c' }; | |
}; | |
class BuuAbc { | |
method TOP($/) { make "TOP" => $<abc>>>.ast; } | |
method abc($/) { make ~$0 => $<bc>>>.ast; } | |
method bc($/) { make ~$0 => $<c>>>.ast; } | |
method c($/) { make 3; } | |
}; | |
my $r = BUU.parse( "abcabccabbccaababc", :actions( BuuAbc ) ); | |
say $r.ast; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment