Re: why use flex?

tnaran@direct.ca (Travers Naran)
1 Feb 1999 23:35:13 -0500

          From comp.compilers

Related articles
why use flex? frankhale@worldnet.att.net (Frank Hale) (1999-01-27)
Re: why use flex? irclark@latveria.castledoom.org (1999-01-31)
Re: why use flex? rkrayhawk@aol.com (1999-01-31)
Re: why use flex? tnaran@direct.ca (1999-02-01)
Re: why use flex? colas@aye.inria.fr (1999-02-03)
Re: why use flex? Marko.Makela@HUT.FI (Marko =?ISO-8859-1?Q?M=E4kel=E4?=) (1999-02-03)
Re: why use flex? tnaran@direct.ca (1999-02-05)
Re: why use flex? Theodore.Papadopoulo@sophia.inria.fr (Theodore.Papadopoulo) (1999-02-05)
Re: why use flex? Marko.Makela@HUT.FI (Marko =?ISO-8859-1?Q?M=E4kel=E4?=) (1999-02-10)
Re: why use flex? wvenable_net@iname.com (1999-02-15)
[1 later articles]
| List of all articles for this month |

From: tnaran@direct.ca (Travers Naran)
Newsgroups: comp.compilers
Date: 1 Feb 1999 23:35:13 -0500
Organization: Rangersoft Vancouver
References: 99-01-111
Keywords: lex

Frank Hale (frankhale@worldnet.att.net) pontificated:
> Why would someone use flex as opposed to writing there own lexer? I am
> developing my own scripting language and find it much simpler to
> create a lexer on my own, that way I can tailor it to my needs. What
> makes using flex any easier, the code it generates is very large and
> confusing even for a simple lexer.


I have not found that in my own experience. Flex, to me, is a
no-brainer when it comes to writing lexical scanners. I can usually
whip up a Flex lexer in 1/4 the time it takes me to hand-code one.
The only real complaint I have is the *still* lacking direct C++
support. If one wants that, one has to use to modified Flex++/Bison++
utilities.


> [Writing your first flex lexer takes a while. After that, I find it
> much faster than hand-coding. Also, if you can arrange your lexer so
> it doesn't have to back up, which is usually possible, it's generally
> faster than hand-coded because of the DFA pattern matching engine.
> -John]


It does? I picked up flex faster than I picked up the regex -> FSM
mapping algorithm.
[It does usually take a little while to understand the way flex works,
particularly the fact that yylex() acts like a coroutine that picks up
where it left off if you return. -John]





Post a followup to this message

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