Mercurial > hg > Papers > 2019 > anatofuz-thesis
view paper/codes/grammer.p6 @ 78:a456a90f9f35
add perl6 sample code
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 18 Feb 2019 20:29:10 +0900 |
parents | |
children | cbd990446e05 |
line wrap: on
line source
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」