Re: regular expression operators in CF grammars

"Neelakantan Krishnaswami" <neelk@alum.mit.edu>
14 Jun 2002 15:20:33 -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: regular expression operators in CF grammars parsersinc@yahoo.com (SLK Parsers) (2002-06-13)
Re: regular expression operators in CF grammars neelk@alum.mit.edu (Neelakantan Krishnaswami) (2002-06-14)
Re: regular expression operators in CF grammars rboland@unb.ca (Ralph Boland) (2002-06-17)
Re: regular expression operators in CF grammars cfc@world.std.com (Chris F Clark) (2002-06-17)
Re: regular expression operators in CF grammars kgw-news@stiscan.com (2002-06-20)
Re: regular expression operators in CF grammars kgw-news@stiscan.com (2002-06-28)
Re: regular expression operators in CF grammars parsersinc@yahoo.com (SLK Parsers) (2002-06-28)
Re: regular expression operators in CF grammars parsersinc@yahoo.com (SLK Parsers) (2002-06-28)
[15 later articles]
| List of all articles for this month |

From: "Neelakantan Krishnaswami" <neelk@alum.mit.edu>
Newsgroups: comp.compilers
Date: 14 Jun 2002 15:20:33 -0400
Organization: AT&T Broadband
References: 02-05-142 02-05-151 02-06-024
Keywords: parse
Posted-Date: 14 Jun 2002 15:20:33 EDT

SLK Parsers <parsersinc@yahoo.com> wrote:
> > While this question is being asked I would like to know if any
> > compiler/parser textbooks deal with grammars that use regular
> > expression operators. This is particularly relavent to LL based
> > parsing because most LL based parsing tools now support extended CFGs.
> > 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?
>
> The classical, and proven grammar analysis algorithms in parsing
> theory are based on definitions that do not include a notion of
> regular expressions as in EBNF. Adhoc programming methods that
> internally translate EBNF run the risk of introducing incorrectness.


I've spent the last week writing a recursive descent parser, and my
experience is a bit different from yours. For me, writing functions
that encapsulated common patterns greatly simplified the parser and
made it much more readable. All but one of those common patterns were
the regular operators: +, *, ?. (The one was bracketed, delimited
sequences, like '(x, y, z)' or '{foo; bar; baz}'.)


I found that this also made the grammar easier to understand, because
there were fewer productions in it.
--
Neel Krishnaswami
neelk@alum.mit.edu


Post a followup to this message

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