Compile C program -> .pyc file

Grant Edwards grante at visi.com
Fri Oct 21 11:52:15 EDT 2005


On 2005-10-21, Fredrik Lundh <fredrik at pythonware.com> wrote:
>
>> Is there a way to compile a C program into a .pyc file that
>> has the same behavior as the compiled C program?
>
> unless you find a C->Python compiler, no.

Or a C->Python-byte-code compiler.

> PYC files contain Python bytecode, C compilers usually
> generate native code for a given machine platform.

Generating byte-code for a stack-based virtual machine used to
be fairly popular for Pascal.  [I once typed in from a book a
Pascal compiler in 8080 assembly language that generate
P-code.] Generating Python byte code from Pascal wouldn't be
terribly difficult, but doing so for C would be pretty tough
because you'd have to figure out how to fake all the low-level
pointer shenanigans which C allows (or some would say depends
upon).

-- 
Grant Edwards                   grante             Yow!  Are we live or
                                  at               on tape?
                               visi.com            



More information about the Python-list mailing list