Re: parsing extended CFGs, was Compiler books for beginners?

"Chris F Clark" <cfc@world.std.com>
31 May 2002 22:54:23 -0400

          From comp.compilers

Related articles
Compiler books for beginners? bart@dynarec.com (2002-05-27)
Re: Compiler books for beginners? rboland@unb.ca (Ralph Boland) (2002-05-27)
Re: parsing extended CFGs, was Compiler books for beginners? cfc@world.std.com (Chris F Clark) (2002-05-31)
Re: parsing extended CFGs, was Compiler books for beginners? joachim_d@gmx.de (Joachim Durchholz) (2002-05-31)
| List of all articles for this month |
From: "Chris F Clark" <cfc@world.std.com>
Newsgroups: comp.compilers
Date: 31 May 2002 22:54:23 -0400
Organization: Compilers Central
References: 02-05-142 02-05-151
Keywords: parse
Posted-Date: 31 May 2002 22:54:23 EDT

Ralph Boland asked:
> Why has LR based parser generator tools that directly support (that do
> not translate the grammar into non-extended form) regular expression
> operators so uncommon anyway; other than that they are fairly complex?


There are two answers.


1) It is simple to rewrite a grammar into the non-extended form, and
      that turns every regular expression operator into a non-terminal
      which has some advantages in terms of the type of tree constructed
      also.


2) If your parser generator accept regular expressions without
      conversion, it has to know how to reduce arbitrary length rules.
      The original parser generators did that by "lookback", but that is
      a horrible method.


Personally, we prefer that the parser generator handle the regular
expressions without conversion, and so Yacc++ does it that way.


Hope this helps,
-Chris


*****************************************************************************
Chris Clark Internet : compres@world.std.com
Compiler Resources, Inc. Web Site : http://world.std.com/~compres
3 Proctor Street voice : (508) 435-5016
Hopkinton, MA 01748 USA fax : (508) 435-4847 (24 hours)


Post a followup to this message

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