[Python-Dev] Re: Re: pirate (python+parrot)
logistix
logistix at cathoderaymission.net
Tue Aug 5 03:58:32 EDT 2003
[guido at python.net]
> wrote:
> > Sure, but bytecode evolves slowly enough to be useful for Dan; given
> > that the only parse tree format we have is *intricately* linked with
> > the Python parser and (at least part of) its runtime,
>
[AMK]
> It is? Both translators are using the compiler package, not
> the parser
> module; can it be said to be intricately linked with the runtime?
> Admittedly it uses the parser module underneath, but the AST
> representation
> itself is pretty generic, isn't it?
>
As Michal touched on earlier, I wrote a hand-coded pure-python parser
that plugs into the compiler package. It takes about 1.5-2x as long to
compile vs using the native parser module. The resultant tuples can
also be shoved back into genuine parse trees via parser.sequence2ast().
So yeah, it's not that big of a deal to generate AST trees without the
runtime (until some crazy function attribute syntax gets added to
python, that is)
http://www.cathoderaymission.net/~logistix/python/pparser.py
-Grant
More information about the Python-Dev
mailing list