Skip to content

Instantly share code, notes, and snippets.

@grondilu
Created November 20, 2012 17:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save grondilu/4119616 to your computer and use it in GitHub Desktop.
Newick Perl 6 grammar test
use v6;
grammar Newick {
rule TOP { <node> ';' }
rule node {
<name> |
'(' (<neighbor=node>+)+ % ',' ')' <name>?
}
token name { [ <.alpha> | <.digit> ]+ }
}
my @data = .split: "\n" given q :to 'EOF';
(cat)dog;
dog cat
(dog,cat);
dog cat
EOF
say Newick.parse($_) for @data;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment