[Types-sig] Plea for help.

Greg Stein gstein@lyra.org
Tue, 14 Dec 1999 11:56:50 -0800 (PST)


On Tue, 14 Dec 1999, Guido van Rossum wrote:
> > Is there currently any path from high level parse trees to bytecodes?
> > E.g. is there a way to get sane parse trees to "render" themselves as,
> > er, insane parse trees? I don't think so but I'm just checking to avoid
> > extra work.
> 
> The parser module lets you construct a parse tree and then compile
> it.  The parse tree must be correct before this is allowed.  Check out
> the compileast() function on
> http://www.python.org/doc/current/lib/Converting_ASTs.html

While it is certainly possible to go from a transformer-tree back to an
ast-tree and then to compile -- if that's what you want, then why use the
transformer at all?

:-)

As Bill said: you can definitely generate a pyc from a transformer tree. I
believe it is bit easier than doing it from AST, too. But it isn't a
cake-walk... there are a lot of constructs in there.

Hrm. Well... the Python bytecodes certainly map better. It was difficult
for us to go to C, but maybe generating bytecodes won't be too hard.

If anybody is thinking about doing this, then please talk with Bill and I
first. genc.py is not the best model. In a proprietary compiler (e.g. I
can't release it yet), we built a *much* better model. There are some
things that are similar, but others that really need to change.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/