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]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.