Testing complex new syntax

Carl Friedrich Bolz cfbolz at gmx.de
Tue Jan 17 18:15:59 EST 2006


astromog at gmail.com wrote:
> Carl Friedrich Bolz wrote:
> 
>>I cannot really say much about how easy it would be to just write a
>>preprocessor. However, I think what you are trying to do could be done
>>reasonably easy with the PyPy project:
>>
>>http://codespeak.net/pypy
>>
>>PyPy is an implementation of a Python interpreter written in Python.
>>(Disclaimer: I am a PyPy developer). It has a quite flexible
>>parser/bytecode compiler that could probably be tweaked to support your
>>new syntax (especially if the new constructs can be mapped to standard
>>python).
> 
> 
> It looks like the lack of thread support means I can't just use PyPy by
> itself, unfortunately.

There is thread-support (using a GIL), but it is indeed not perfect yet. 
This will definitively be a topic in the next months, though.

> But the tokeniser, lexer, parser and AST builder
> could do what I need with modification, then I could walk the generated
> AST and produce standard Python code from that. How easy would it be to
> separate these parts out from the rest of PyPy?

Should be reasonably easy, although I am no expert in that area of PyPy. 
  Especially since the output of the parser/compiler is regular python 
2.4 bytecode.

Cheers,

Carl Friedrich Bolz




More information about the Python-list mailing list