Can You Program the Propeller Using Python?
Scope
Posts: 417
I did a quick scan but I found nothing.
Thanks
Thanks
Comments
Spin is actually fairly similar to Python.
If someone wrote a Python byte code interpreter in pasm, it would be possible to run Python.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com E-mail: mikronauts _at_ gmail _dot_ com 5.0" VGA LCD in stock!
Morpheus dual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory/IO kit $89.95, both kits $189.95 SerPlug $9.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler Largos - upcoming nano operating system
Then, once the Basic Compiler is stable, reverse engineer a Python interpreter from the many source code implementations.
And don't forget Bill's Basic Compiler (hint, hint).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
JMH
It is still in the works, but is now taking back seat to finishing the hardware projects I am working on in time for UPEW... I am introducing quite a few new products.
I also intend to demo PropellerBasic at UPEW, however revenue generating projects come first (I don't have a "day job")
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
www.mikronauts.com E-mail: mikronauts _at_ gmail _dot_ com 5.0" VGA LCD in stock!
Morpheus dual Prop SBC w/ 512KB kit $119.95, Mem+2MB memory/IO kit $89.95, both kits $189.95 SerPlug $9.95
Propteus and Proteus for Propeller prototyping 6.250MHz custom Crystals run Propellers at 100MHz
Las - Large model assembler Largos - upcoming nano operating system
There are at least three C compilers for the Prop.
Two of them compile to almost native PASM code in the so called LMM mode. That is ICC from ImageCraft Inc, a commercial product, and Catalina, a free open source project.
Thirdly it is possible to use GCC compiling C to byte codes which are then executed on the Prop via the Zog byte cdoe interpreter. This is rather like the Spin byte code system and consequently slower than ICC or Catalina.
I'll let you search the forum for these, they are easy enough to find.
That was the way C++ was compiled originally and perhaps some systems still do that. I don't know of any. Modern C++ compilers work more directly. For example the GCC compiler:
C++ -> Intermediate representation -> Assembly language -> binary object code -> executable binary.
You can "catch it midway" at the assembly language stage if you like.
There are better, easier ways to redirect stdio. Standard I/O is provided by the C/C++ runtime libraries. All you have to do is modify those libraries or just build your program with your own custom read/write functions linked in.
One can run C++ code on the Prop compiled with GCC under the Zog interpreter. I believe that is the only way to run C++ on the Prop at this time.
What you are describing is what is called a cfront which is how the original C++ compilers were developed. As it turns out, comeau c++ is an existing cfront that has been around from the early days and should be able to do what you want. Not sure how active it is but I used to know it's author and the product was top notch. http://www.comeaucomputing.com/
Spin is about as "fairly similar" to Python as a worm is "fairly similar" to a python:)
I suspect that a Python interpreter would be far to big a thing to implement on a Prop. Unless you had a C implementation running under Catalina using external RAM. But then it would be pretty slow.
Still, many other such "impossible" things have happened on the Prop.