The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: scj@yaccman.com (scj@yaccman.com)
Subject: [TUHS] Short history of 'grep'
Date: Mon, 1 Feb 2016 11:26:10 -0800	[thread overview]
Message-ID: <4dda350d543908e59a54dc0ea356dc6c.squirrel@webmail.yaccman.com> (raw)
In-Reply-To: <alpine.LSU.2.00.1602011030020.21662@hermes-2.csi.cam.ac.uk>


: Al Aho decided to put theory into practice, and implemented full regular
: expressions (including alternation and grouping which were missing from
: grep)and wrote egrep over a weekend. Fgrep, specialised for the case of
: multiple (alternate) literal strings, was written in the same weekend.
: Egrep was about twice as fast as grep for simple character searches but
: was slower for complex search patterns (due to the high cost of building
: the state machine that recognised the patterns).

I remember talking to Al about his programming experiences not long after
he wrote egrep.  His focus was theory, and he wrote far more books and
papers than programs.  He said something like: "I never realized that you
had to write so many different algorithms to get something to work.  I
thought I just needed to write one!"

Also, as a practical example of exponential blowup doing an fgrep-like
problem, use lex to recognize a bunch of reserved words ("if","for","else",
"while","int",... and such) and follow it with lnu* to recognize
identifier names (where lnu recognizes letters, numbers, and underscore). 
I gave up on lex for PCC when the lexer got bigger than all the rest of
the compiler...

Steve



  reply	other threads:[~2016-02-01 19:26 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-30  3:00 Warren Toomey
2016-01-30 19:10 ` Mary Ann Horton
2016-01-30 19:44   ` Dave Horsfall
2016-01-30 20:20     ` Mary Ann Horton
2016-01-30 20:40       ` Dave Horsfall
2016-01-30 21:42         ` Marc Rochkind
2016-01-31  1:41           ` Dave Horsfall
2016-01-31  1:50             ` Larry McVoy
2016-01-31  2:06             ` jason-tuhs
2016-01-31  4:20               ` Random832
2016-01-31 17:11               ` Mary Ann Horton
2016-01-31 17:38                 ` John Cowan
2016-02-01 10:48                 ` Tony Finch
2016-01-31  2:37             ` John Cowan
2016-02-01 10:38               ` Tony Finch
2016-02-01 19:26                 ` scj [this message]
2016-01-31 17:01 Doug McIlroy
2016-03-05  1:48 ` Dave Horsfall
2016-03-05  1:54   ` Larry McVoy
2016-02-01 20:57 Doug McIlroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4dda350d543908e59a54dc0ea356dc6c.squirrel@webmail.yaccman.com \
    --to=scj@yaccman.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).