[pypy-dev] Why CFFI is not useful - need direct ABI access 4 humans

Bengt Richter bokr at oz.net
Thu Apr 3 16:09:29 CEST 2014


Hi Anatoly,

On 04/03/2014 10:33 AM anatoly techtonik wrote:

[...]
>  My goal is
> to work with low level binary data in Python with convenient tools. Not
> necessary high level tools - just convenient for messing with chunks.

[Nathan]
>> Exception handling: There are as many ways to handle exceptions as
>> there are compilers, all of them with subtle rules around lifetimes of
>> all the objects that are being excepted over.
>
> I would be interested to see this on binary level, but I doubt such
> papers exist. Making a library that can produce diagrams for such
> structures will be a good starting point to grok at more serious
> performance problem when you switch CPUs.
>

I think you might enjoy reading about LLVM and their approach to
representing bit-level stuff, and interfacing with various languages'
definitions of exceptions etc:

     http://llvm.org/docs/index.html

particularly

     http://llvm.org/docs/LangRef.html

from the introduction of the latter:

     The LLVM code representation is designed to be used in three
     different forms: as an in-memory compiler IR, as an on-disk
     bitcode representation (suitable for fast loading by a
     Just-In-Time compiler), and as a human readable assembly
     language representation. This allows LLVM to provide a
     powerful intermediate representation for efficient compiler
     transformations and analysis, while providing a natural
     means to debug and visualize the transformations. The three
     different forms of LLVM are all equivalent. This document
     describes the human readable representation and notation.

[...]

I think you may have some interesting ideas. I am also interested
in a high level language with ability to get down to the metal, so I
am trying to design one. The trouble is, scouting around for ideas,
you may wind up doing more reading than actually working. Ltu is
particularly dangerous ;-)

     http://lambda-the-ultimate.org/

I think you should try to design the language you want, according
to your ideas. IME there is no better way to gain respect and appreciation
for other people's work in language design ;-)

When you want to write your compiler, python is there. Or you may find
racket's ability to define alternate syntax languages interesting:

     http://docs.racket-lang.org/guide/languages.html

Their home pages is

     http://racket-lang.org/

Have fun ;-)

Regards,
Bengt Richter



More information about the pypy-dev mailing list