Created
December 6, 2012 10:16
-
-
Save grondilu/4223474 to your computer and use it in GitHub Desktop.
Newick Perl 6 grammar test
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
use v6; | |
my $sample = q :to 'STOP'; | |
(cat)dog; | |
dog cat | |
(dog,cat); | |
dog cat | |
STOP | |
grammar Newick { | |
rule TOP { <node> ';' } | |
token node { | |
| <name> | |
| '(' ~ ')' <node>+ % ',' <name> | |
} | |
token name { <alpha>* } | |
} | |
for $sample.split: "\n" { | |
.say if Newick.parse: $_; | |
} | |
# vim: ft=perl6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment