Related articles |
---|
[21 earlier articles] |
Re: is lex useful? trd@murlibobo.cs.mu.OZ.AU (1996-06-30) |
Re: is lex useful? WStreett@shell.monmouth.com (1996-06-30) |
Re: is lex useful? dmr@bell-labs.com (1996-06-30) |
Re: is lex useful? clark@quarry.zk3.dec.com (1996-07-01) |
Re: is lex useful? bromage@cs.mu.OZ.AU (1996-07-02) |
Re: is lex useful? kanze@lts.sel.alcatel.de (1996-07-02) |
Re: is lex useful? colas@aye.inria.fr (1996-07-04) |
Re: is lex useful? trd@lister.cs.mu.OZ.AU (1996-07-05) |
From: | colas@aye.inria.fr (Colas Nahaboo) |
Newsgroups: | comp.compilers |
Date: | 4 Jul 1996 15:33:50 -0400 |
Organization: | Koala Project, Bull Research France |
References: | 96-06-094 96-06-129 |
Keywords: | lex |
Stephen Lindholm <72510.2757@CompuServe.COM> writes:
|> Along with the additional readability, I don't see why anyone
|> wouldn't use flex, aside from really bizzare syntax requirements
|> in a particular application.
Well, I have a counter-example: when your parser input can be changed on
the fly.
I have a OO-lisp-like interpreter that can read transparently on file or
string objects, and you can seek the current cursor position at any time on
these objects, too.
I was using lex, but I had to support 8-bit character, so I thought it was
a good motivation to switch to flex. Well, it was a nigthmare, and the
resulting parser is much slower (10 times...!!!) than the lex one.
Why?
Because flex tries to optimize too much its input, and you have no control
on it. So when you seek to a different place in the file, you have to break
all flex optimisations, and do a lot of dirty work. Same goes with providing
parsing either on files or strings. And I don't tell you about modifying the
string while parsing it :-), all things legal and useful in dynamic script
languages. Unfortunately I had to complete the job quickly so I continues
with flex, but as soon as I have time, I will try the re2c solution.
flex is great to write a parser to parse "fixed" files, however.
--
Colas Nahaboo, Koala/Dyade/Bull @ INRIA Sophia, http://www.inria.fr/koala/colas
[I don't understand your problem. Flex has a bunch of documented internal
routines that let you take input from anywhere you want. If it ended up
being slower than lex, you must have been doing something really odd. -John]
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.