Exponentiation operator precedence
Mark S. Miller
erights at google.com
Tue Aug 25 17:55:34 UTC 2015
Sorry. I just has another look at your proposed grammar and you are correct.
On Tue, Aug 25, 2015 at 10:54 AM, Claude Pache <claude.pache at gmail.com>
wrote:
>
> Le 25 août 2015 à 19:25, Mark S. Miller <erights at google.com> a écrit :
>
> It also does not work. x ** y ** z, if we allow it at all, must be right
> associative. It must parse as x ** (y ** z).
>
>
> Unless I missed something, it *is* right-associative.
> —Claude
>
>
> On Tue, Aug 25, 2015 at 10:08 AM, Mark S. Miller <erights at google.com>
> wrote:
>
>> It does not work as well as simply omitting ** entirely.
>>
>>
>> On Tue, Aug 25, 2015 at 9:42 AM, Isiah Meadows <isiahmeadows at gmail.com>
>> wrote:
>>
>>> I like this. It works very well.
>>>
>>> On Tue, Aug 25, 2015, 12:38 Claude Pache <claude.pache at gmail.com> wrote:
>>>
>>>>
>>>> I think the following grammar could work.
>>>> Replace the current (ES2015) PostfixExpression production with:
>>>>
>>>> ```
>>>> IncrementExpression:
>>>> LeftHandSideExpression
>>>> LeftHandSideExpression [no LineTerminator here] ++
>>>> LeftHandSideExpression [no LineTerminator here] --
>>>> ++ LeftHandSideExpression
>>>> -- LeftHandSideExpression
>>>> ```
>>>>
>>>> And define UnaryExpression as:
>>>>
>>>> ```
>>>> UnaryExpression:
>>>> IncrementExpression
>>>> delete UnaryExpression
>>>> void UnaryExpression
>>>> typeof UnaryExpression
>>>> ++ UnaryExpression
>>>> + UnaryExpression
>>>> -- UnaryExpression
>>>> - UnaryExpression
>>>> ~ UnaryExpression
>>>> ! UnaryExpression
>>>> IncrementExpression ** UnaryExpression
>>>> ```
>>>>
>>>> where the following production (which exists only to avoid to
>>>> confusingly interpret, e.g., `++x++` as `+ +x++`):
>>>>
>>>> ```
>>>> UnaryExpression:
>>>> ++ UnaryExpression
>>>> -- UnaryExpression
>>>> ```
>>>>
>>>> yields a static SyntaxError (or a static ReferenceError if we want to
>>>> be 100% compatible ES2015).
>>>>
>>>>
>>>> That way, we have the following expected behaviour:
>>>> * in/decrement operators bind most tightly;
>>>> * unary and exponentiation operators are applied from right to left.
>>>>
>>>>
>>>> —Claude
>>>>
>>>>
>>>> _______________________________________________
>>>> es-discuss mailing list
>>>> es-discuss at mozilla.org
>>>> https://mail.mozilla.org/listinfo/es-discuss
>>>>
>>>
>>
>>
>> --
>> Cheers,
>> --MarkM
>>
>
>
>
> --
> Cheers,
> --MarkM
>
>
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
--
Cheers,
--MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150825/5553c32c/attachment-0001.html>
More information about the es-discuss
mailing list