unit grammar GulgPlayer;
proto rule expr {*} # Examples parsed by rules:
multi rule expr:sym<method> { $<obj>=<.terms> $<method>=<.ident>'(' <.terms> ')' } # object method(arg1, arg2)
multi rule expr:sym<infix> { $<lhs>=<.terms> $<infix>=<.ident> $<rhs>=<.terms> } # vec1 add vec2
multi rule expr:sym<function> { $<function>=<.ident> <.terms> } # delete &value; func a, b
multi rule expr:sym<sub-expr> { $<other-terms>=<terms> } # ((vec1 add vec2) mul vec3)
rule terms { [ '&'?<.ident> ]+ % ',' | '(' ~ ')' $<sub-expr>=<expr> } # a; b,c; (d,e,f); (g op h)
rule TOP { \v * <expr> * %% \v + }
token ws { <!ww> \h* }
say GulgPlayer.parse:
'
delete &value
object method(arg1, arg2)
(func a, b, c)
((vec1 add vec2) mul vec3)
'