Re: --- Regexps, compilers etc., prog help ---

kanze@gabi-soft.fr (J. Kanze)
14 Mar 1997 00:34:37 -0500

          From comp.compilers

Related articles
--- Regexps, compilers etc., prog help --- sjain@a.chem.upenn.edu (1997-02-11)
Re: --- Regexps, compilers etc., prog help --- the_artful_parser@null.net (Quinn Tyler Jackson) (1997-02-16)
Re: --- Regexps, compilers etc., prog help --- pfox@lehman.com (Paul David Fox) (1997-02-16)
Re: --- Regexps, compilers etc., prog help --- jmccarty@sun1307.spd.dsccc.com (1997-02-20)
Re: --- Regexps, compilers etc., prog help --- nkramer@cs.cmu.edu (Nick Kramer) (1997-02-20)
Re: --- Regexps, compilers etc., prog help --- ok@cs.rmit.edu.au (1997-02-22)
Re: --- Regexps, compilers etc., prog help --- kanze@gabi-soft.fr (1997-03-14)
Re: --- Regexps, compilers etc., prog help --- the_artful_parser@null.net (1997-03-16)
Re: --- Regexps, compilers etc., prog help --- henry@zoo.toronto.edu (Henry Spencer) (1997-03-21)
Re: --- Regexps, compilers etc., prog help --- henry@zoo.toronto.edu (Henry Spencer) (1997-03-21)
| List of all articles for this month |

From: kanze@gabi-soft.fr (J. Kanze)
Newsgroups: comp.compilers
Date: 14 Mar 1997 00:34:37 -0500
Organization: GABI Software
References: 97-02-072 97-02-122 97-02-125
Keywords: lex, design

ok@cs.rmit.edu.au (Richard A. O'Keefe) writes:


|> Hursh Jain <sjain@a.chem.upenn.edu> wrote:
|> >I am interested in writing a regular expression evaluator, and also a
|> >toy compiler..
|>
|> Basic regular expressions are dealt with in "Software Tools", which is
|> such a classic it's probably out of print.


As much as I love the "Software Tools" book, I fear that it is dated
in this regard. Their algorithms don't actually handle full regular
expressions. On the other hand, they don't require much memory, but
this isn't generally considered an issue these days. (Although IMHO,
there are cases where it should be. In an editor, for example. You
don't really want to run out of memory in the middle of a regular
expression match.)


|> Even AWK and PERL are pathetically restricted compared with SNOBOL
|> patterns. It might be of interest that the next release of the (free)
|> GNAT compiler for Ada is going to include a _full_ implementation of
|> SNOBOL patterns. (Robert Dewar worked on the SPITBOL implementation
|> of SNOBOL, and is one of the key players in the GNAT team.)
|>
|> With this around, I expect never to write a regular expression
|> evaluator again in my life.
|>
|> --
|> Richard A. O'Keefe; http://www.cs.rmit.edu.au/%7Eok; RMIT Comp.Sci.
|> [Well, sure, but there can be the issue of performance. I've written some
|> pretty rococo Snobol patterns in my time, with lots of backing up and
|> conditional assignments and stuff, but one thing they were not is fast.
|> REs can be matched in one pass, no backup. -John]


Concerning the moderator's comment: most regular expression's I see
these days have been extended to allow saving part of the match. I
think that this requires back-tracking (or does anyone know of a one
pass solution that works in all cases).


Even with normal regular expressions, there are a number of tradeoffs
between memory use, execution time and flexibility. Enough to make me
think that there still will be occasions for writing your own parser.
--
James Kanze +33 (0)1 39 55 85 62 email: kanze@gabi-soft.fr
GABI Software, Sarl., 22 rue Jacques-Lemercier, 78000 Versailles, France
--


Post a followup to this message

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