Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- grammar Number
- {
- token TOP { <SCALAR> }
- token SCALAR { ONE
- | TWO
- | THREE
- | FOUR
- { make $/.made; }
- }
- # Termination tokens
- token ONE { one {make 1;} }
- token TWO { two {make 2;} }
- token THREE { three {make 3;} }
- token FOUR { four {make 4;} }
- }
- for lines() {
- my $match = Number.parse($_).made;
- say $match<SCALAR>.made
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement