[Types-sig] "Mobius2" -- high performance Python-extensible Python parser

Michel Pelletier michel@digicool.com
Mon, 16 Apr 2001 19:58:39 -0700 (PDT)


Ok, I tried this out for a bit, trying to come up with a prototype of PEP
245.

After a couple of hours, I think I wrapped my head around it enough to
figure some stuff out.

mycodegen generates the actual bytecode.  I'm not sure how to get this
thing to say 'instanciate one of these things defined in a python module'.

mymodule is some kind of top level compiler object that I override with my
code generator and my transformer.

mynodes defines the classes for any new types of nodes I'm adding and
registers them.

I'm not sure what a transformer does, turns parsed code into an AST?  I
think I have that right.

So anyway, my blockage is, I think, in the codegen step.  How do I tell it
to create bytecodes that import a module and instanciate a class I define?
Maybe I need to read up on bytecodes more...

Any help would be great,

-Michel

I think I have it to the point where it understands my interface grammer,
I'm just not sure how to tell it to import a module to create, for
example, interface nodes.

On Wed, 11 Apr 2001, Jeff Epler wrote:

> When the Types sig was just getting up to speed the last time, someone
> expressed that there's no easy way to prototype language extensions.
> I mentioned "mobius", which is a Python compiler based on a SPARK grammar.
>
> Mobius had performance problems, and didn't ease the implementation of
> the new grammar in core Python because it used a different syntax of
> grammar.
>
> Mobius2 exposes the Python parser and parser generator to Python code.
> It means that you get all the speed of the builtin parser[1], its
> reliability[2] and extensibility, and easy portability to core Python.
>
> If any types-sig proposals include language extensions, I suggest that you
> take a look at Mobius2.
>
> http://sourceforge.net/projects/mobiuspython/
>
> The portions of interest are the "mobius2" directory, and the demo/*2
> directories (currently just two simple uses of mobius2).
>
> Jeff
> jepler@inetnebr.com
> jepler@sourceforge.net
> [1] Actually, it's about 15% faster, and I'm not sure why.
> [2] A 159-case test suite covers all productions in the core Python 2.0
>     language.  All cases are verified to produce the same results (ASTs)
>     as the builtin parser, which isn't terribly surprising.
>
> _______________________________________________
> Types-SIG mailing list
> Types-SIG@python.org
> http://mail.python.org/mailman/listinfo/types-sig
>