[Tutor] comiling python to microchip?

R. Alan Monroe amonroe at columbus.rr.com
Thu Oct 13 02:28:34 CEST 2005


> From: "Jeff Peery" <jeffpeery at yahoo.com>
>> is it possible to take python code and compile it for use in a 
>> microprocessor?
>>

> In the same way that Sun have been threatening to build a chip that has Java
> as its machine code then it would be possible to build a chip that ran 
> Python
> bytecode but it would be a huge investment.

> Its certainly not possible woth current Python to generate code that can run
> outside of an operating system on a microchip. ON the otherhand if that
> chop is running even a basic operating system that supports a C compiler
> then it should be possible to build the Python interpreter for the chip/OS
> combo and use python that way.

> In other words, no, you can't currently get a completely standalone
> machine code program from Python code at present. It would be
> feasible to port Python to most micro chip OSs such as CP/M,
> PSOS, QXL(?) etc and its possible that some such port has already
> been done but I don't know of it.

Something I noticed while playing with the dis module is that the
python virtual machine appeared to use the same opcode for adding both
integers and strings, for instance. It would be tricky, or slow, to
translate this into other languages, I bet.

Alan



More information about the Tutor mailing list