function application vs. infix operator precedence
Stephen Weeks
sweeks@acm.org
Wed, 13 Mar 2002 19:10:52 -0800
> I have made my own infix operator (let's say it's called $) that
> takes an int on the left side, an int->int function on the right
> side, and returns a function int->int.
>
> this works [and is the functionality i am going for]: (1 $ f) 2
> but this doesn't [this is the syntax i want, though]: 1 $ f 2
>
> i guess f is being applied to 2, which i don't want.
>
> so is there a way to make the $ bind with a higher precedence than the
> function application?
This question is probably better directed at comp.lang.ml since there
is nothing specific to MLton, but I'll give it a shot.
I don't think there is any way to give an infix operator higher
precedence than application. The grammar for expressions on page 63
of the Definition includes the productions
exp ::= infexp
| ...
infexp ::= appexp
| infexp vid infexp
appexp ::= atexp
| appexp atexp
atexp ::= scon | longid | ... | (exp)
Taken together, I take these to mean that the juxtaposition in appexp
binds more tightly than the vid in infexp.
Hopefully this makes some sense.