Re: Infinite look ahead required by C++?

glen herrmannsfeldt <gah@ugcs.caltech.edu>
Wed, 10 Feb 2010 17:02:18 +0000 (UTC)

          From comp.compilers

Related articles
Infinite look ahead required by C++? ng2010@att.invalid (ng2010) (2010-02-05)
Re: Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-02-06)
Re: Infinite look ahead required by C++? idbaxter@semdesigns.com (Ira Baxter) (2010-02-06)
Re: Infinite look ahead required by C++? thurston@complang.org (Adrian Thurston) (2010-02-08)
Re: Infinite look ahead required by C++? sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-02-09)
Re: Infinite look ahead required by C++? gah@ugcs.caltech.edu (glen herrmannsfeldt) (2010-02-10)
Re: Infinite look ahead required by C++? sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-02-10)
Re: Infinite look ahead required by C++? cfc@shell01.TheWorld.com (Chris F Clark) (2010-02-10)
Re: Infinite look ahead required by C++? martin@gkc.org.uk (Martin Ward) (2010-02-11)
Re: Infinite look ahead required by C++? idbaxter@semdesigns.com (Ira Baxter) (2010-02-13)
Re: Infinite look ahead required by C++? sh006d3592@blueyonder.co.uk (Stephen Horne) (2010-02-14)
Re: Infinite look ahead required by C++? wclodius@los-alamos.net (2010-02-13)
[5 later articles]
| List of all articles for this month |

From: glen herrmannsfeldt <gah@ugcs.caltech.edu>
Newsgroups: comp.compilers
Date: Wed, 10 Feb 2010 17:02:18 +0000 (UTC)
Organization: California Institute of Technology, Pasadena
References: 10-02-024 10-02-039
Keywords: C++, parse
Posted-Date: 10 Feb 2010 12:21:30 EST

Stephen Horne <sh006d3592@blueyonder.co.uk> wrote:
(snip)


> No problem there. But now, let's assume that we want a variable of
> some struct type.


> mystruct x;


> The fact that "mystruct" identifies a type is significant - it is how
> this is recognised as a variable declaration. But how does the parser
> *know* that "mystruct" is a type at all?


(snip)


> C used to require that you write something like...


> struct mystruct x;


I would say that C still does. It is typedef that causes the problem
that you mention, and typedef is commonly used with structure
declarations. You can typedef int just as easily as struct.


-- glen



Post a followup to this message

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