On Fri, Mar 6, 2009 at 1:48 PM, Geoffrey Irving <[email protected]> wrote:
> I'm definitely in favor of Option 2, and don't understand why (f 1 + f
> 2) would require parentheses.  Can you explain the problem in more
> detail?  Most (all?) languages with curry style notation for function
> calls give application higher precedence than addition (including
> math, for example), so (f 1 + f 2) should be fine.

The problem is that in things like

  f a b + f c d

we do not know how many arguments to "consume" for f until f is typed,
and we don't have that information at parse time. This works in ML
*because* of curried forms. The parser builds:

  ((f a) b)  # apply left-associative
  (+ ((f a) b) f c d ) # apply higher precedence
  (+ ((f a) b) (f c) d ) # apply higher precedence
  (+ ((f a) b) ((f c) d) ) # apply higher precedence

Basically, the whole strategy relies on the fact that the parser never
considers more than one non-terminal immediately to the left of the
current position.

shap
_______________________________________________
bitc-dev mailing list
[email protected]
http://www.coyotos.org/mailman/listinfo/bitc-dev

Reply via email to