ANN compiler2:从Python 2.5抽象语法树生成字节码 [英] ANN compiler2 : Produce bytecode from Python 2.5 Abstract Syntax Trees

查看:135
本文介绍了ANN compiler2:从Python 2.5抽象语法树生成字节码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



宣布:编译器2

---------------------


对于所有字节码爱好者:''compiler2''是标准

库''编译''包的替代品,具有几个优点。


改进的纯python编译器


- 为所有/ Lib

和Lib / test模块的内置编译函数生成相同的字节码* ,包括''窥视孔''优化

- 使用2.5'''工厂安装''ASTs,而不是2.4'''''售后''

版本

- 明显更快


*除了讨厌的堆栈深度计算


可能应用程序


- 理解/记录/验证编译过程

- 实现实验编译功能(编译时常量,

函数插入任何人?)

- 无论旧的编译器pac kage用于;-)

入门

---------------

指向你的svn客户:
http://svn.brownspencer.com /pycompil...nches/new_ast/

查看PYTHONPATH上的compiler2目录

使用python test / test_compiler.py进行测试

干杯

Michael


Announcing: compiler2
---------------------

For all you bytecode enthusiasts: ''compiler2'' is an alternative to the standard
library ''compiler'' package, with several advantages.

Improved pure-python compiler

- Produces identical bytecode* to the built-in compile function for all /Lib
and Lib/test modules, including ''peephole'' optimizations
- Works with 2.5''s ''factory-installed'' ASTs, rather than 2.4''s ''after-market''
version
- Is significantly faster

* Except for the pesky stack-depth calculation

Possible applications

- Understanding/documenting/verifying the compilation process
- Implementing experimental compilation features (compile-time constants,
function in-lining anyone?)
- Whatever the old compiler package is used for ;-)
Getting started
---------------
Point your svn client to:
http://svn.brownspencer.com/pycompil...nches/new_ast/

Check out to a compiler2 directory on PYTHONPATH
Test with python test/test_compiler.py
Cheers
Michael

推荐答案

Michael Spencer写道:
Michael Spencer wrote:

宣布:编译器2

---------------------


对于所有字节码爱好者:''compiler2''是标准

库''编译器''包的替代品,具有几个优点。
Announcing: compiler2
---------------------

For all you bytecode enthusiasts: ''compiler2'' is an alternative to the standard
library ''compiler'' package, with several advantages.



这是从头开始重写还是改进的stdlib编译器包?


在后一种情况下,也许你可以为核心贡献一些补丁。


Georg

Is this a rewrite from scratch, or an improved stdlib compiler package?

In the latter case, maybe you can contribute some patches to the core.

Georg


Georg Brandl写道:
Georg Brandl wrote:

Michael Spencer写道:
Michael Spencer wrote:

>宣布:compiler2
---------------- -----

对于所有字节码爱好者:''compiler2''是标准库''编译''包的替代品,具有几个优点。
>Announcing: compiler2
---------------------

For all you bytecode enthusiasts: ''compiler2'' is an alternative to the standard
library ''compiler'' package, with several advantages.



这是从头开始重写还是改进的stdlib编译器包?


在后一种情况下,也许你可以为核心贡献一些补丁。


Georg


Is this a rewrite from scratch, or an improved stdlib compiler package?

In the latter case, maybe you can contribute some patches to the core.

Georg



Georg


It开始作为后者(即stdlib编译器包改进)和

通过增量更改进行,其目标是生成正确的
目标代码并创建一个干净的编译器体系结构(后者有点

主观当然)。原则上我会很高兴为这项工作做出贡献,但是这些变化的总和相当于一次重大的重写,所以我不认为它是好的。
可以作为补丁有意义地提交。


问候


Michael

Georg

It started as the latter (i.e., the stdlib compiler package improved) and
proceeded via incremental change with the twin goals of generating correct
object code and creating a clean compiler architecture (the latter somewhat
subjective of course). I''d be happy in principle to contribute the work, but
the sum of the changes amounts to a substantial re-write, so I don''t think it
can be meaningfully submitted as a patch.

Regards

Michael


Michael Spencer写道:
Michael Spencer wrote:

Georg Brandl写道:
Georg Brandl wrote:

> Michael Spencer写道:
>Michael Spencer wrote:

>>宣布:compiler2
---------------------
>>Announcing: compiler2
---------------------

For all you bytecode enthusiasts: ''compiler2'' is an alternative to the standard
library ''compiler'' package, with several advantages.


这是从头开始重写还是改进的stdlib编译器包?

在后一种情况下,也许你可以为核心贡献一些补丁。 gr />
Georg


Is this a rewrite from scratch, or an improved stdlib compiler package?

In the latter case, maybe you can contribute some patches to the core.

Georg



Georg


它起始于后者(即stdlib编译器包改进了)并且

通过增量更改进行,其目标是生成正确的
目标代码并创建一个干净的编译器架构(后者有点

主观当然)。原则上我会很高兴为这项工作做出贡献,但是这些变化的总和相当于一次重大的重写,所以我不认为它是好的。
可以作为补丁有意义地提交。


Georg

It started as the latter (i.e., the stdlib compiler package improved) and
proceeded via incremental change with the twin goals of generating correct
object code and creating a clean compiler architecture (the latter somewhat
subjective of course). I''d be happy in principle to contribute the work, but
the sum of the changes amounts to a substantial re-write, so I don''t think it
can be meaningfully submitted as a patch.



也许你可以就python-dev讨论你的改进

以及如何将它们集成到标准库中。 。


Georg

Perhaps you can bring up a discussion on python-dev about your improvements
and how they could be integrated into the standard library...

Georg


这篇关于ANN compiler2:从Python 2.5抽象语法树生成字节码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆