unit grammar GulgPlayer;
proto rule expr {*} # Example each rule parses:
multi rule expr:method { <args> <fn>'(' <args> ')' } # object method(arg1, arg2)
multi rule expr:infixish { <args> <fn> <args> } # vec1 add vec2; arg fn;
multi rule expr:function { <fn> <args> } # delete &value; func a,b,c
multi rule expr:sub-expr { '(' <expr> ')' } # (func a, b, c)
rule args { [ '&'?<.arg>] + % ',' | '(' <expr> ')' } # a; a,b,...; ((a b c) b d)
token arg { <.ident> } # <alpha> <alnum>*
token fn { <.ident> } # <alpha> <alnum>*
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)
'