Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I learn more about PyPy's translation function? [closed]

I've been having a hard time trying to understand PyPy's translation. It looks like something absolutely revolutionary from simply reading the description, however I'm hard-pressed to find good documentation on actually translating a real world piece of code to something such as LLVM. Does such a thing exist? The official PyPy documentation on it just skims over the functionality, rather than providing anything I can try out myself.

like image 586
tslocum Avatar asked Aug 26 '08 08:08

tslocum


4 Answers

This document seems to go into quite a bit of detail (and I think a complete description is out of scope for a stackoverflow answer):

  • http://codespeak.net/pypy/dist/pypy/doc/translation.html

The general idea of translating from one language to another isn't particularly revolutionary, but it has only recently been gaining popularity / applicability in "real-world" applications. GWT does this with Java (generating Javascript) and there is a library for translating Haskell into various other languages as well (called YHC)

like image 115
rcreswick Avatar answered Nov 11 '22 08:11

rcreswick


If you want some hand-on examples, PyPy's Getting Started document has a section titled "Trying out the translator".

like image 3
sanxiyn Avatar answered Nov 11 '22 08:11

sanxiyn


PyPy translator is in general, not intended for more public use. We use it for translating our own python interpreter (including JIT and GCs, both written in RPython, this restricted subset of Python). The idea is that with good JIT and GC, you'll be able to speedups even without knowing or using PyPy's translation toolchain (and more importantly, without restricting yourself to RPython).

Cheers, fijal

like image 3
fijal Avatar answered Nov 11 '22 09:11

fijal


Are you looking for Python specific translation, or just the general "how do you compile some code to bytecode"? If the latter is your case, check the LLVM tutorial. I especially find chapter two, which teaches you to write a compiler for your own language, interesting.

like image 2
wvdschel Avatar answered Nov 11 '22 09:11

wvdschel