use Grammar::Tracer;
use Terminal::ANSIColor;
&colored.wrap(-> $a, $b { $a });
&color.wrap(-> $a { "" });
&BOLD.wrap(-> { "" });
&RESET.wrap(-> { "" });
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));
}