9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@coraid.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] Replacements for lex
Date: Fri, 19 Jan 2007 16:06:14 -0500	[thread overview]
Message-ID: <a4814dce430a1d8d30368a95e9f8ca60@coraid.com> (raw)
In-Reply-To: <cd128265c2aeb0f2ea89aa932a6f283a@vitanuova.com>

i think the ken c lexer is a very good example.  it shows how
goto, well applied, can be a very useful tool for an ad hoc problem.
it also shows that in practice lexers and parsers are seldom as
separate as they appear in textbooks.

on the other hand, rc has a very hairy lexer. hoc has a small, elegant one.
i believe the _practice of programming_ goes into detail about it.

- erik

On Fri Jan 19 15:37:42 EST 2007, forsyth@vitanuova.com wrote:
> >I expect the lexer in /sys/src/cmd/cc/ will be a good example.
>
> it's a little more elaborate than some (not gcc!) because it takes on limited C preprocessing
> duties as well.  you might also observe that the author enjoys his gotos, but since it is essentially
> a finite state machine that seems fair enough, and furthermore he's allowed to take advantage of his
> `licence to GOTO' awarded after a killer early paper. (Since that was about automata, it should probably
> be an Earley paper, except that it's slightly earlier than that.)  anyway, he meant no harm.


  reply	other threads:[~2007-01-19 21:06 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-19 18:58 Joel Salomon
2007-01-19 19:12 ` Dan Cross
2007-01-19 19:26   ` Joel Salomon
2007-01-19 20:35     ` C H Forsyth
2007-01-19 21:06       ` erik quanstrom [this message]
2007-01-19 21:09       ` Taj Khattra
2007-01-19 21:18         ` Brantley Coile
2007-01-20  8:47     ` William Josephson
2007-01-20  9:08       ` Bruce Ellis
2007-01-19 19:13 ` Brantley Coile
2007-01-19 19:18 ` erik quanstrom
2007-01-19 19:24   ` Federico Benavento
2007-01-20  8:44 ` William Josephson

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=a4814dce430a1d8d30368a95e9f8ca60@coraid.com \
    --to=quanstro@coraid.com \
    --cc=9fans@cse.psu.edu \
    /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).