-
-
Save AlexDaniel/a77b2555bfd0fb11e843712a8412883b to your computer and use it in GitHub Desktop.
This file contains 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
grammar Parser { | |
rule TOP { I <love> <lang> } | |
token love { '♥' | love } | |
token lang { < Perl Rust Go Python Ruby > } | |
} | |
say Parser.parse: 'I ♥ Perl'; | |
# OUTPUT: 「I ♥ Perl」 love => 「♥」 lang => 「Perl」 | |
say Parser.parse: 'I love Rust'; | |
# OUTPUT: 「I love Rust」 love => 「love」 lang => 「Rust」 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment