[BangPypers] converting python to assembly..

Vishal vsapre80 at gmail.com
Fri Jun 1 15:14:36 CEST 2012


Sending again. Since the files did not go through... :(

On Fri, Jun 1, 2012 at 4:41 PM, Vishal <vsapre80 at gmail.com> wrote:

>
>> Hello  Sriram,
>
> I think there is some confusion as to what the general-case Python to C
> compiler's create. So I made a test case and have attached the input and
> output files. hopefully this will clear some doubts about why 2c-py is not
> what the original question indicated.
>
> Please find some files attached:
>
> a) "test.py" a very simple 1KB python file with a main function
> b) "_c_test.c" a 35KB file that is generated by 2c-py
>
> (b) gets generated by the following cmd line:
>
> > 2c-py -c test.py
>
> As you can see the 'c' file generated references python's internals.
> What I am looking for is something that would either create a functional
> equivalent in C or the ASM for the target microcontroller.
>
> Best regards,
> Vishal Sapre
>
> p.s: just in case the files dont go through, here's some part of the files;
>
> *test.py:*
> def main(x):
>     if x > 5:
>         print "x is greater than 5"
>     else:
>         print "x is not greater than 5"
>
> main()
>
> *_c_test.c : *
>
> /* Generated by 2C Python */
>
> #include "Python.h"
> #include "frameobject.h"
> #include "funcobject.h"
> #include "code.h"
> #include "opcode.h"
> #include "dictobject.h"
> #include "listobject.h"
> #include "abstract.h"
>
> #include "structmember.h"
> #include "object.h"
>
> PyTypeObject Py2CCode_Type;
>
> PyTypeObject Py2CFunction_Type;
>
> #define Py2CCode_Check(op) (Py_TYPE(op) == &Py2CCode_Type)
> #define Py2CFunction_Check(op) (Py_TYPE(op) == &Py2CFunction_Type)
> ....
> ....
> ....
>
-- 
Thanks and best regards,
Vishal Sapre


More information about the BangPypers mailing list