grammar Fly {
rule TOP {
<line>*
}
token function {
"function"
\s+
<ident>
\s*
<list>
\s*
<block>
}
token block {
"{"
<line>*
"}"
}
token import {
"import"
\s+
<ident>
}
token statement {
[^\s\(\)\{\}\[\]]+
}
token line {
<import> | <function> | <block> | <statement> | [\s|";"]+
}
token list {
"("
[
<statement>
","
]*
<statement>?
")"
}
}
sub MAIN(){
my $input = slurp;
say Fly.parse($input);#, :actions(Fly::Actions));
}