2009/4/4 john skaller <[email protected]>
>
> On 05/04/2009, at 2:13 AM, Emmanuel Onzon wrote:
>
>>
>> Unfortunately this makes a real mess of expression RHS. You have to write:
>>
>> expr [term] = expr[term] + expr[<term];
>>
>> to get left associativity and the right precendences (or is that right
>> assoc ?)
>>
>> This is left assoc, since expr of priority term are not allowed
>> on the right side of +.
>>
>
> Argument is fallacious :) Since it would also be the case if I wrote >term.
> I always get confused by ordering: if
>
> x < y
>
> which has the higher priority, x or y? If like integers, y is bigger,
> though I usually associate bigger integers with lower priority!
>
> But the notation also suggest x is "above" y in a lattice.
> And indeed for boolean
>
> x < y MEANS x implies y
>
> that is
>
> x --> y
>
> which is not at all intuitive. Anyhow just a rant ... :)
> [Erick said he was missing them so, here's one for
> him to enjoy on the weekend :->
>
When you have
p1 < p2
you cannot tell which priority yields the highest precedence.
You must consider the rule that is using them.
If you have:
expr:
| expr(<=p1) "#" expr(<p1) {} p1
| expr(<=p2) "^" expr(<p2) {} p2
Then the operator # has higher precedence than ^.
And associativity is left.
But with the rules:
expr:
| expr(>=p1) "#" expr(>p1) {} p1
| expr(>=p2) "^" expr(>p2) {} p2
^ has higher precedence than #.
And the associativity is still left.
------------------------------------------------------------------------------
_______________________________________________
Felix-language mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/felix-language