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? (Dan E. Kelley) (1996-06-21)
Re: is lex useful? (1996-06-23)
Re: is lex useful? (Ronald Kanagy) (1996-06-23)
Re: is lex useful? (1996-06-24)
Re: is lex useful? kelley@Phys.Ocean.Dal.Ca (1996-06-24)
Re: is lex useful? (1996-06-24)
Re: is lex useful? (1996-06-24)
Re: is lex useful? (1996-06-26)
Re: is lex useful? (1996-06-26)
Re: is lex useful? (Stefan Monnier) (1996-06-26)
Re: is lex useful? (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 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:


Post a followup to this message

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