Re: Lexical feedback

Richard Pennington <>
Sun, 22 Oct 1995 00:47:19 GMT

          From comp.compilers

Related articles
Lexical feedback (Paul Long) (1995-09-22)
Re: Lexical feedback (Mitchell Perilstein) (1995-09-29)
Re: Lexical feedback (Paul Long) (1995-10-06)
Lexical feedback 75066.3204@CompuServe.COM (Carl Barron) (1995-10-21)
Re: Lexical feedback (Richard Pennington) (1995-10-22)
Re: Lexical feedback (1995-10-23)
Re: Lexical feedback (1995-10-25)
| List of all articles for this month |

Newsgroups: comp.compilers
From: Richard Pennington <>
Keywords: lex, yacc
Organization: Introl Corporation
References: 95-09-143 95-10-032 95-10-065
Date: Sun, 22 Oct 1995 00:47:19 GMT

Lately I've been playing with parsers for C and C++ in byacc and
btyacc. The byacc grammars, based on Roskind grammars, work but are
extremely large. Straightforward grammars for btyacc can be devised,
are compact, and, I believe, easier to understand.

My question is this: for a production compiler, is it better (that
is, faster or more efficient for compilation) to use something akin
to the Roskind grammar rather than a backtracking grammar? Does it
even matter with today's machines?

I do believe that from a program maintenance point of view that the
simpler grammars possible in a backtracking environment win. On the
other hand, In my experience, the parser is usually the last thing
that needs maintenance.

If noone has a definitive answer (or opinion!) I will post my benchmarks
comparing both approaches in the next week or so.

Richard Pennington Introl Corporation, Milwaukee, WI USA
Email: Phone: +1 414-273-6100 Fax: +1 414-273-6106
NetBSD, X11R6, etc. mirrors:
[I'd use the backtracking grammar for two reasons -- you can produce better
error messages, and at the rate C++ is mutating your parser will surely
need maintenance. -John]


Post a followup to this message

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