On 9 February 2015 at 01:51, Jonathan S. Shapiro <[email protected]> wrote:
> Later in that same thread, however, I introduced the example: > > f1 a + f1 b > > > which is a bit more interesting. The question here becomes: what is the > relative precedence of application and mixfix-+. There is no confusion > about how the precedence grammar should behave here; the answer is > unambiguously determined by the precedence choices. The only question here > is a matter of aesthetics: do we wish to minimize the use of parentheses > for the sake of readability? > > The one guideline that seems worth preserving here is that the > construction of the AST cannot depend on the types of the elements. If we > decide that application has the highest precedence, then we're going to > parse that example as > > (((((f1 a) +) f1) b) > > Alternatively, if we decide that '+' has higher precedence, we will parse > as: > > (f1 a) + (f1 b) > > Isn't that backwards somewhat? if they have equal precedence, (((f1 a) +) f1) b). if + has higher precedence, ((f1 (a + f1)) b). if + has lower precedence, (f1 a) + (f1 b). > My personal opinion is that this is a very confusing parse of > > f1 a + f1 b > > > in a language that adopts currying, because the mental convention here is > "things accumulate left to right". > Are people regularly confused about how infix operators work in ML family languages? > Yup. Parens in BitC are done in the mixfix engine! But this means that the > following two expressions are structurally similar, differentiated only by > precedence: > > f a + f b > f a , f b > > > It seems syntactically uncomfortable, but I don't really see any good way > to eliminate the issue entirely unless we move these sorts of constructs > back into the arena of "language predefined expressions". > Sorry Shap - I just don't comprehend your discomfort here. -- William Leslie Notice: Likely much of this email is, by the nature of copyright, covered under copyright law. You absolutely MAY reproduce any part of it in accordance with the copyright law of the nation you are reading this in. Any attempt to DENY YOU THOSE RIGHTS would be illegal without prior contractual agreement.
_______________________________________________ bitc-dev mailing list [email protected] http://www.coyotos.org/mailman/listinfo/bitc-dev
