[Python-Dev] Re: Automatic flex interface for Python?

Gordon McMillan gmcm@hypernet.com
Wed, 21 Aug 2002 09:31:36 -0400


On 21 Aug 2002 at 10:34, Fredrik Lundh wrote:

> eh?  why did my mailer send that mail?  what I was
> trying to say is that I'm mildly curious why people
> tend to treat mxTextTools like some kind of silver
> bullet, without actually comparing it to a well-
> written regular expression.
> 
> I've heard from people who've spent days rewriting
> their application, only to find that the resulting
> program was slower.
> 
> (as Guido noted, for problems like this, the
> overhead isn't so much in the engine itself, as in
> the effort needed to create Python data
> structures...) 

mxTextTools lets (encourages?) you to break all
the rules about lex -> parse. If you can (& want to)
put a good deal of the "parse" stuff into the scanning
rules, you can get a speed advantage. You're also
not constrained by the rules of BNF, if you choose
to see that as an advantage :-).

My one successful use of mxTextTools came after
using SPARK to figure out what I actually needed
in my AST, and realizing that the ambiguities in the
grammar didn't matter in practice, so I could produce
an almost-AST directly.

-- Gordon
http://www.mcmillan-inc.com/