my $grammar = q{ list : '(' item(s) ')' { $item[2] } item : list { $item[1] } | word word : /[^()]*/ };