Treffer: MSE-seminar: Program Analysis and Transformation Martin Kempf

Title:
MSE-seminar: Program Analysis and Transformation Martin Kempf
Authors:
Contributors:
The Pennsylvania State University CiteSeerX Archives
Publication Year:
2011
Collection:
CiteSeerX
Document Type:
Fachzeitschrift text
File Description:
application/pdf
Language:
English
Rights:
Metadata may be used without restrictions as long as the oai identifier remains attached to it.
Accession Number:
edsbas.9039CCC5
Database:
BASE

Weitere Informationen

The C/C++ metaprogramming toolkit for Python [16], CodePy [2], is analysed according to its source code generation possibility and its way to generate extension modules for Python. The combination of both results in generating C code in a Python script and executing it from within the same script. Insights are given on how this roundtrip is achieved using the Boost Python [1] library. It is outlined why Boost Python simplifies this roundtrip and with Instant Python [8] another toolkit is introduced that also enables to call a C function that is former described in a Python string. The analysis of the code generation capability of CodePy includes a comparison of the syntax tree building approach, as CodePy's way to describe the target code, with the approach of using the Mako [10] template engine. The advantages of Python in combination with machine code compiled libraries are outlined as well as the advantages of code generation at runtime. With PyCUDA [15] a project is introduced which makes use of these advantages by combining Python and CUDA [3], and it is shown how CodePy can be used in conjunction with PyCUDA.