Newick tree format

Author: Lucien Grondin

See https://en.wikipedia.org/wiki/Newick_format.

Source code: Newick.pm

use v6;

grammar Newick {
    rule TOP { '(' <subtree>** 2..3 % \, ');' }
    rule subtree { <species> | '(' <subtree>** 2 % \, ')' }
    token species { <.ident>+ }
}