2009/11/27 Christian Heimes <lists@cheimes.de>
Cesare Di Mauro wrote:
>
> You'll find some at page 28
> here<http://wpython.googlecode.com/files/Beyond%20Bytecode%20-%20A%20Wordcode-based%20Python.pdf>
> ..
>
> Mart made more interesting
> ones<http://www.mail-archive.com/python-dev@python.org/msg43282.html>with
> Unladen benchmarks.

The PDF document sounded interesting and I was tempted to test WPython.
Unfortunately it doesn't compile on my box:

$ make
gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall
-Wstrict-prototypes  -I. -IInclude -I./Include   -DPy_BUILD_CORE -o
Python/ast.o Python/ast.c


Python/ast.c:30: warning: ‘enum _expr_const’ declared inside parameter
list
Python/ast.c:30: warning: its scope is only this definition or
declaration, which is probably not what you want

Python/ast.c:335: warning: ‘enum _expr_const’ declared inside parameter
list
Python/ast.c:335: error: parameter 2 (‘constant’) has incomplete type

Python/ast.c: In function ‘Const’:

Python/ast.c:341: error: ‘Const_kind’ undeclared (first use in this
function)

Python/ast.c:341: error: (Each undeclared identifier is reported only
once
Python/ast.c:341: error: for each function it appears in.)

Python/ast.c:342: error: ‘union <anonymous>’ has no member named ‘Const’

Python/ast.c:343: error: ‘union <anonymous>’ has no member named ‘Const’

Python/ast.c: In function ‘set_context’:

Python/ast.c:457: error: ‘Const_kind’ undeclared (first use in this
function)

Python/ast.c: At top level:

Python/ast.c:591: warning: ‘enum _expr_const’ declared inside parameter
list
Python/ast.c:590: error: conflicting types for ‘seq_for_testlist’

Python/ast.c:29: note: previous declaration of ‘seq_for_testlist’ was here
[...]

$ gcc --version
gcc (Ubuntu 4.4.1-4ubuntu8) 4.4.1
$ uname -a
Linux hamiller 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC
2009 x86_64 GNU/Linux


I have created a new project at Google Code: http://code.google.com/p/wpython2/ using Mercurial for the repository.

The master (Python 2.6.4) code is located into the default repository:
https://wpython2.googlecode.com/hg/

The wpython (version 1.0) clone is in:
https://wpython10.wpython2.googlecode.com/hg/

Sources are available in:
http://code.google.com/p/wpython2/downloads/list

wpython 1.0 is an almost complete replacement for Python 2.6.4 (except for Doc/library.dis.rst, which I'll update later, when I stop adding or changing opcodes).

I have changed the ASDL grammar (in Parser/Python.asdl) so that there's no need to overwrite Include/Python-ast.h, and I've added full support for constants to the AST code (I left Num_kind and Str_kind untouched right now, but I plan to remove them in the next release, since Const_kind is able to hold any kind of constant object).

Now you shouldn't have problems compiling it.

Cesare