Re: How to handle operator of undefined associativity

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Mon, 3 May 2010 03:53:20 +0000 (UTC)

          From comp.compilers

Related articles
How to handle operator of undefined associativity singh.pallav@gmail.com (Pallav singh) (2010-04-29)
Re: How to handle operator of undefined associativity bear@sonic.net (Ray) (2010-05-01)
Re: How to handle operator of undefined associativity bartc@freeuk.com (bart.c) (2010-05-01)
Re: How to handle operator of undefined associativity cr88192@hotmail.com (BGB / cr88192) (2010-05-01)
Re: How to handle operator of undefined associativity cfc@shell01.TheWorld.com (Chris F Clark) (2010-05-02)
Re: How to handle operator of undefined associativity gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-05-03)
Re: How to handle operator of undefined associativity cr88192@hotmail.com (BGB / cr88192) (2010-05-05)
Re: How to handle operator of undefined associativity gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-05-05)
Re: How to handle operator of undefined associativity cfc@shell01.TheWorld.com (Chris F Clark) (2010-05-06)
Re: How to handle operator of undefined associativity sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-05-07)
Re: How to handle operator of undefined associativity pat@jantar.org (Patryk Zadarnowski) (2010-05-10)
Re: How to handle operator of undefined associativity alex.colvin@valley.net (mac) (2010-05-12)
[1 later articles]
| List of all articles for this month |
From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Mon, 3 May 2010 03:53:20 +0000 (UTC)
Organization: California Institute of Technology, Pasadena
References: 10-04-073 10-05-011
Keywords: parse
Posted-Date: 05 May 2010 13:32:19 EDT

BGB / cr88192 <cr88192@hotmail.com> wrote:
(snip)


> I guess I will add here that associativity only really makes
> sense when binary operators are in use:
> "3+4*5" => "(3+4)*5" or "3+(4*5)", ...


> but, with a unary operator, there is only a single possible parsing:
> the operator and the expression it operates on.


That is true if you allow only prefix operators, or only
postfix operators, but not if you allow both. Consider C:


      *x++ is *(x++) or (*x)++


Where * and ++ are both unary operators.


> one can't have associativity directly between the operators,
> as this would not make sense:
> "! ! ! x" => "(! !) ! x;"? nope...


Traditionally, Fortran didn't allow two operators next to each
other without parenthesis. It might be that the rules have changed
some over the years, but I believe that you still can't say


        .NOT..NOT..NOT.X


-- glen
[This isn't associativity, it's precedence. Humph. -John]



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.