Re: Lookahead vs. Scanner Feedback

bliss@sp64.csrd.uiuc.edu (Brian Bliss)
Tue, 7 Jan 92 00:00:15 GMT

          From comp.compilers

Related articles
Lookahead vs. Scanner Feedback hjelm+@cs.cmu.edu (1992-01-03)
Re: Lookahead vs. Scanner Feedback rockwell@socrates.umd.edu (Raul Deluth Miller-Rockwell) (1992-01-04)
Re: Lookahead vs. Scanner Feedback bliss@sp64.csrd.uiuc.edu (1992-01-07)
Re: Lookahead vs. Scanner Feedback sef@kithrup.COM (1992-01-07)
Re: Lookahead vs. Scanner Feedback Jan.Rekers@cwi.nl (1992-01-07)
Re: Lookahead vs. Scanner Feedback burley@geech.gnu.ai.mit.edu (1992-01-07)
Re: Lookahead vs. Scanner Feedback drw@lagrange.mit.edu (1992-01-07)
Re: Lookahead vs. Scanner Feedback smk@dcs.edinburgh.ac.uk (1992-01-07)
Re: Lookahead vs. Scanner Feedback bill@twwells.com (1992-01-08)
[7 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: bliss@sp64.csrd.uiuc.edu (Brian Bliss)
Keywords: yacc, parse, question
Organization: UIUC Center for Supercomputing Research and Development
References: 92-01-012
Date: Tue, 7 Jan 92 00:00:15 GMT

In article 92-01-012, hjelm+@cs.cmu.edu (Mark Hjelm) writes:
|> I have a parser, written using Yacc and Lex, for ANSI C. The grammar is
|> taken pretty much verbatim from the standard. The scanner uses the symbol
|> table to decide whether to return "identifier" or "typedef name" as the
|> token type for an identifier. How do I KNOW that there are no situations
|> which, due to parser lookahead, would cause the scanner to return an
|> incorrect token type for an identifier ... ?


One place where every yacc/lex based C compiler I know of is
broken is on a typedef name redefined in an inner scope:


typedef int foo;


main ()
      {
            char foo;
      }


is legal ANSI C. I think there was a thread on this a while back.


bb
--


Post a followup to this message

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