Making regex suck less

Fredrik Lundh fredrik at pythonware.com
Wed Sep 4 03:14:06 EDT 2002


Gerson Kurz wrote:

> Seriously, my thinking was, the re.compile function is there to
> compile an expression to a binary representation for optimized
> searching. So maybe, a "clean syntax" -> "ugly re syntax" compiler
> would be good?

note that the SRE engine contains an "ugly syntax" to "internal
data structure" parser, and an "internal data structure" to "engine
code" compiler.

it's probably easier (and definitely more efficient) to turn a clean
syntax into an "internal data structure" than into an ugly syntax.

(the next step is to use python's own parse tree instead of SRE's
internal structure, and use an extension to python's compiler for
the final step.  make it all pluggable, and you have perl6...)

</F>





More information about the Python-list mailing list