Re: How to handle operator of undefined associativity

Patryk Zadarnowski <pat@jantar.org>
Mon, 10 May 2010 10:11:05 +1000

          From comp.compilers

Related articles
[4 earlier articles]
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)
Re: How to handle operator of undefined associativity gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-05-12)
| List of all articles for this month |
From: Patryk Zadarnowski <pat@jantar.org>
Newsgroups: comp.compilers
Date: Mon, 10 May 2010 10:11:05 +1000
Organization: Compilers Central
References: 10-04-073 10-05-011 10-05-020 10-05-026
Keywords: C, standards
Posted-Date: 10 May 2010 01:22:41 EDT

> [I happen to have C99 here, and they did change it. The grammar
> separates out
> postfix-expression and unary-expression, with postfix-expression
> coming first.
> Offhand, I can't think of any plausible examples where the C99
> grammar would
> parse an expression differently. -John]


John, et. al,


C99 didn't change it, the only difference between the C89 and C99
expression
grammars is addition of compound literals (the "(type-name){...}"
syntax.)
Both C89 and C99 recognise postfix operators as "postfix-expression" and
prefix operators as "unary-expression" as follows:


(6.3.1) primary-expression:
identifier
constant
string-literal
( expression )


(6.3.2) postfix-expression:
primary-expression
postfix-expression [ expression ]
postfix-expression ( argument-expression-list-opt )
postfix-expression . identifier
postfix-expression -> identifier
postfix-expression ++
postfix-expression --


(6.3.3) unary-expression:
postfix-expression
++ unary-expression
-- unary-expression
unary-operator cast-expression
sizeof unary-expression
sizeof ( type-name )


(6.3.3) unary-operator: one of
& * + - ~ !


(6.3.4) cast-expression:
unary-expression
( type-name ) cast-expression


(6.3.5) multiplicative-expresison
cast-expression
multiplicative-expression * cast-expression
... (and so on)


Hope that helps to clarify this thread.


Cheers,


Pat.
[C89 and C99 are the same here, but K&R was, as I recall, a different definition
although the language it accepted seems to be the same. -John]







Post a followup to this message

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