Re: is lex useful?

kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
24 Jun 1996 15:10:16 -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)
Re: is lex useful? rgreen@barach.bbn.com (1996-06-26)
Re: is lex useful? leichter@smarts.com (Jerry Leichter) (1996-06-27)
[16 later articles]
| List of all articles for this month |

From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Newsgroups: comp.compilers
Date: 24 Jun 1996 15:10:16 -0400
Organization: GABI Software, Sarl.
References: 96-06-091
Keywords: lex, performance, comment

The moderator writes:


|> [The advantage of precomputing the state machine is that your lexer can run
|> a lot faster. AT&T lex is slow, but that's due to bad implementation. Flex
|> is quite fast, easily competitive with hand-written lexers. -John]


I'd be very surprised if it could compete with a lexer which just uses
a big switch on the character. And of course, once you know that the
next character is, e.g., alpha, there are very quick methods to scan
the rest.


On the other hand, I'm curious if anyone has looked into the
possibility of using mixed scanners. A quick switch on the first
character to catch the easy cases (symbols, white space to skip, etc.),
and the possibility of using regular expressions for the harder ones,
which hopefully don't occur as frequently in the source code.
--
James Kanze Tel.: (+33) 88 14 49 00 email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
[The inner loop in a flex lexer is basically two table lookups, in the same
ballpark as a switch. -John]
--


Post a followup to this message

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