Re: Why context-free?

henry@spsystems.net (Henry Spencer)
26 Oct 2005 14:44:37 -0400

          From comp.compilers

Related articles
[21 earlier articles]
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-10-20)
Re: Why context-free? find@my.address.elsewhere (Matthias Blume) (2005-10-23)
Re: Why context-free? lhp+news@toft-hp.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen) (2005-10-23)
Re: Why context-free? stephen@dino.dnsalias.com (2005-10-23)
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-10-26)
Re: Why context-free? wyrmwif@tsoft.org (SM Ryan) (2005-10-26)
Re: Why context-free? henry@spsystems.net (2005-10-26)
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-10-27)
Re: Why context-free? dot@dotat.at (Tony Finch) (2005-10-27)
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-10-29)
Re: Why context-free? henry@spsystems.net (2005-10-29)
Re: Why context-free? nmm1@cus.cam.ac.uk (2005-11-01)
| List of all articles for this month |

From: henry@spsystems.net (Henry Spencer)
Newsgroups: comp.compilers
Date: 26 Oct 2005 14:44:37 -0400
Organization: SP Systems, Toronto, Canada
References: 05-10-053 05-10-079
Keywords: parse, syntax
Posted-Date: 26 Oct 2005 14:44:37 EDT

Neelakantan Krishnaswami <neelk@cs.cmu.edu> wrote:
>Splitting the task of parsing into phases -- a) lexing, b) parsing,
>and c) type-checking -- is just plain old good engineering...


This can apply even to things that are not traditionally thought of as
languages. The second or third time I implemented POSIX regular
expressions, I experimented with using a distinct scanner and parser
rather than trying to do everything in a parser. I was startled at how
much easier this was, and how much cleaner the code was. All sorts of
things that had previously contorted the parser logic became two lines of
code apiece in the scanner. In particular, the distinction between
"basic" (ed-style) and "extended" (egrep-style) REs became essentially
a choice of two different scanners, invisible to the parser.
--
spsystems.net is temporarily off the air; | Henry Spencer
mail to henry at zoo.utoronto.ca instead. | henry@spsystems.net


Post a followup to this message

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