Re: Generating a simple hand-coded like recursive descent parser

Chris Dollin <chris.dollin@hp.com>
25 Sep 2006 17:06:11 -0400

          From comp.compilers

Related articles
[17 earlier articles]
Re: Generating a simple hand-coded like recursive descent parser tommy.thorn@gmail.com (Tommy Thorn) (2006-09-12)
Re: Generating a simple hand-coded like recursive descent parser mr.waverlye@verizon.net (Mr.E) (2006-09-16)
Re: Generating a simple hand-coded like recursive descent parser tommy.thorn@gmail.com (Tommy Thorn) (2006-09-18)
Re: Generating a simple hand-coded like recursive descent parser DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-09-21)
Re: Generating a simple hand-coded like recursive descent parser chris.dollin@hp.com (Chris Dollin) (2006-09-22)
Re: Generating a simple hand-coded like recursive descent parser DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-09-25)
Re: Generating a simple hand-coded like recursive descent parser chris.dollin@hp.com (Chris Dollin) (2006-09-25)
Re: Generating a simple hand-coded like recursive descent parser DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-09-26)
Re: Generating a simple hand-coded like recursive descent parser zebedee@zebedee.net (zebedee) (2006-09-28)
Re: Generating a simple hand-coded like recursive descent parser DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-09-28)
Re: Generating a simple hand-coded like recursive descent parser phaywood@alphalink.com.au (2006-09-30)
Re: Generating a simple hand-coded like recursive descent parser DrDiettrich1@aol.com (Hans-Peter Diettrich) (2006-12-16)
Re: Generating a simple hand-coded like recursive descent parser bobduff@shell01.TheWorld.com (Robert A Duff) (2006-12-17)
[14 later articles]
| List of all articles for this month |
From: Chris Dollin <chris.dollin@hp.com>
Newsgroups: comp.compilers
Date: 25 Sep 2006 17:06:11 -0400
Organization: HP labs, Bristol
References: 06-09-02906-09-042 06-09-048 06-09-060 06-09-078 06-09-093 06-09-108 06-09-117 06-09-125
Keywords: parse, C
Posted-Date: 25 Sep 2006 17:06:11 EDT

Hans-Peter Diettrich wrote:


> Chris Dollin wrote:
>
>>>#defined names, and the parser adds all encountered typedef names. This
>>>procedure works fine, provided that typedefs always have global scope,
>>>as is required in C.
>>
>> Not so far as I'm aware: I couldn't find such a restriction for C90,
>> and could find implications in the text that it would be allowed.
>
> C99 states that type declarations are not allowed in C procedure
> definitions.


Interesting. The draft has no such restriction in the typedef section,
and an explicit example with a typedef inside a function. Could you
provide a cite for me?


>> Experimentally, `gcc -ansi -pedantic` was quite happy with a typedef
>> inside `main`.
>
> The standard may differ between C and C++.


Don't care about C++; the issue was whether or not typedefs have to
be global /in C/.


> What gcc does, that's another story ;-)


Which is why I specified `-ansi -pedantic`. (And I've just checked with
`-std=c99`.) gcc might of course be wrong, but I don't recall this
case ever having com up in comp.lang.c.


--
Chris "falling further in" Dollin
"I'm still here and I'm holding the answers" - Karnataka, /Love and Affection/


Post a followup to this message

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