Re: is lex useful?

kelley@Phys.Ocean.Dal.Ca (Dan Kelley)
24 Jun 1996 15:04:29 -0400

          From comp.compilers

Related articles
is lex useful? kelley@phys.ocean.dal.ca (Dan E. Kelley) (1996-06-21)
Re: is lex useful? qjackson@direct.ca (1996-06-23)
Re: is lex useful? rkanagy@erols.com (Ronald Kanagy) (1996-06-23)
Re: is lex useful? qjackson@direct.ca (1996-06-24)
Re: is lex useful? kelley@Phys.Ocean.Dal.Ca (1996-06-24)
Re: is lex useful? Scott.Nicol@infoadvan.com (1996-06-24)
Re: is lex useful? kanze@lts.sel.alcatel.de (1996-06-24)
Re: is lex useful? bos@serpentine.com (1996-06-26)
Re: is lex useful? dhami@mdd.comm.mot.com (1996-06-26)
Re: is lex useful? stefan.monnier@lia.di.epfl.ch (Stefan Monnier) (1996-06-26)
Re: is lex useful? raph@kiwi.cs.berkeley.edu (1996-06-26)
[18 later articles]
| List of all articles for this month |

From: kelley@Phys.Ocean.Dal.Ca (Dan Kelley)
Newsgroups: comp.compilers
Date: 24 Jun 1996 15:04:29 -0400
Organization: Dalhousie University
References: 96-06-073
Keywords: lex

I'm replying to my own query about whether lex or hand-coded lexing
programs are better. I hope folks don't mind, but I thought I'd
present a little summary of the responses I've had, in addition to
those posts on the group.


Three or four folks replied to me, some of them providing several
replies and all providing quite a lot of information.


In a word, the consensus is that hand-coded lexing programs are
better. They are faster, and not that difficult to write. (An
afternoon spent writing a lexer seems trivial compared to weeks or
months implementing a whole language.) Plus, there are situations in
which it is difficult to write patterns in lex. (I found, for
example, an error in the flex info-page documentation, with regard to
scanning /* */ C-style comments.)


There is an argument to be made that lex makes the scanners much
easier to read, so that some folks suggested using a lex program in
the beginning of the project, especially if the syntax is malleable,
and moving to a hand-coded program later.


Finally, almost everybody noted that ATT lex is buggy, and that GNU
flex is much preferred.


... well, that's it. I hope you folks don't mind my clogging the
group with this reply to my own question.


Let me end by thanking all those folks who sent me their advice. It
helped me a lot. Maybe someday, when I'm not a novice, I can send
some advice along to the next novice ... partly, that's why I'm
sending the present message.


Dan.


--
Dan E. Kelley internet: mailto:Dan.Kelley@Dal.CA
Oceanography Department phone: (902)494-1694
Dalhousie University fax: (902)494-2885
Halifax, NS, CANADA, B3H 4J1 WWW: http://www.phys.ocean.dal.ca/~kelley


--


Post a followup to this message

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