#!/usr/bin/perl
#!/usr/bin/perl
my $input = '(((';
grammar Test {
token TOP {
<down>*
}
token down {
^\($
}
}
class TestActions {
method TOP ($/) {
make @<down>>>.ast;
}
method down ($/) {
make 1;
}
}
my $actions = TestActions.new;
my $res = Test.parse($input, :$actions);
say $res.made;
IyEvdXNyL2Jpbi9wZXJsCiMhL3Vzci9iaW4vcGVybAoKbXkgJGlucHV0ID0gJygoKCc7CgpncmFtbWFyIFRlc3QgewogICAgdG9rZW4gVE9QIHsKICAgICAgICA8ZG93bj4qCiAgICB9CgogICAgdG9rZW4gZG93biB7CiAgICAgICAgXlwoJAogICAgfQp9CgpjbGFzcyBUZXN0QWN0aW9ucyB7CiAgICBtZXRob2QgVE9QICgkLykgewogICAgICAgICBtYWtlIEA8ZG93bj4+Pi5hc3Q7CiAgICB9CiAgICBtZXRob2QgZG93biAoJC8pIHsKICAgICAgICBtYWtlIDE7CiAgICB9Cn0KCm15ICRhY3Rpb25zID0gVGVzdEFjdGlvbnMubmV3OwpteSAkcmVzID0gVGVzdC5wYXJzZSgkaW5wdXQsIDokYWN0aW9ucyk7CnNheSAkcmVzLm1hZGU7Cg==