New C parser [patch]

Kyuupi kyuupichan@gmail.com
Tue Oct 26 12:21:00 GMT 2004


On Tue, 26 Oct 2004 00:37:21 +0000 (UTC), Joseph S. Myers
<jsm@polyomino.org.uk> wrote:

> On Mon, 25 Oct 2004, Zack Weinberg wrote:
> 
> > I'm generally quite happy with this patch.  Could you enumerate all
> > the places where 2-token lookahead is needed, and give an opinion as
> > to how many of those could be eliminated through future cleanups?
> 
> Distinguishing array declarators [*] and [*foo].
> 
> Distinguishing whether an identifier where a statement is expected is a
> label or starts an expression.

Those are the only two in standard C that I don't believe can be
reasonably avoided in a recursive descent parser.
 
> Distinguishing whether '(' in an expression starts a parenthesised
> subexpression, a statement expression or is followed by a type name.
> (Also after sizeof and alignof.)

This wasn't necessary in the parser I have written.
 
> Distinguishing whether an identifier in an expression is followed by '('
> and so could be an implicit function declaration.

I don't believe this is either.

Neil.



More information about the Gcc-patches mailing list