Re: Lookahead vs. Scanner Feedback

drw@lagrange.mit.edu (Dale R. Worley)
Tue, 7 Jan 1992 22:00:20 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)
Re: Lookahead vs. Scanner Feedback bliss@sp64.csrd.uiuc.edu (1992-01-08)
Re: Lookahead vs. Scanner Feedback nigelh@sol.UVic.CA (1992-01-08)
Re: Lookahead vs. Scanner Feedback dww@inf.fu-berlin.de (1992-01-08)
Re: Lookahead vs. Scanner Feedback jwoods@convex.com (1992-01-09)
[3 later articles]
| List of all articles for this month |
Newsgroups: comp.compilers
From: drw@lagrange.mit.edu (Dale R. Worley)
Keywords: parse, C
Organization: MIT Dept. of Tetrapilotomy, Cambridge, MA, USA
References: 92-01-012
Date: Tue, 7 Jan 1992 22:00:20 GMT

In article 92-01-012 hjelm+@cs.cmu.edu (Mark Hjelm) writes:
      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 (i.e. return "identifier", even
      though the identifier was just/will be made into a "typedef name")?


Well, I assume that you're being careful about redeclarations. For
instance,


typedef int a;
{
float a;
a++;
}


is legal in ANSI C. What you need, of course, is to have a few places
in the grammar that allow either an identifier or a typedef name.


In general, I know of no way of verifying that your parser has
everything right, although meticulous comparison of the ANSI rules and
your parser will help, and thorough exercising with C validation
suites will help.


Dale Worley Dept. of Math., MIT drw@math.mit.edu
--


Post a followup to this message

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