I have the following minimized grammar
Exp : let var '=' Exp in Exp end { App (Fn $2 $6) $4 }
| Exp Exp { App $1 $2 }
| Exp OpCode Exp { Op $1 Add $3 }
| '(' Exp ')' { $2 }
| num { Num $1 }
| var { Ident $1 }
| '\\' var '.' Exp { Fn $2 $4 }
The Exp Exp
rule is used to apply a function in a value. But if I have something like myFunc 1 2
it defaults to precendence myFunc (1 2)
, which is not what I want. I want (myFunc 1) 2
, for currying.
But how can I define the association if I don't have a non-terminal symbol? Trying to do %left Exp
don't seems to help.