Shop OBEX P1 Docs P2 Docs Learn Events
Can You Program the Propeller Using Python? — Parallax Forums

Can You Program the Propeller Using Python?

ScopeScope Posts: 417
edited 2010-10-26 22:06 in Propeller 1
I did a quick scan but I found nothing.

Thanks

Comments

  • Bill HenningBill Henning Posts: 6,445
    edited 2010-03-25 02:57
    Right now - no.

    Spin is actually fairly similar to Python.

    If someone wrote a Python byte code interpreter in pasm, it would be possible to run Python.
    Scope said...
    I did a quick scan but I found nothing.

    Thanks
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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
  • Mike HuseltonMike Huselton Posts: 746
    edited 2010-03-25 06:06
    Python should be very realizable. But I am still buzzing about the Basic Compiler from Bean.
    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
  • Bill HenningBill Henning Posts: 6,445
    edited 2010-03-25 14:56
    LOL - "(hint, hint)"

    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")
    Mike Huselton said...
    Python should be very realizable. But I am still buzzing about the Basic Compiler from Bean.
    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).
    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    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
  • laser-vectorlaser-vector Posts: 118
    edited 2010-09-07 09:49
    any updates on this?? if i could program a propeller with python that would be awesome!!
  • QUARKSPINQUARKSPIN Posts: 36
    edited 2010-09-07 18:40
    I would give 100 million kudos to whoever does this. Isn't there a C compiler for the prop? I heard somewhere that C++ converts into C before it compiles into bytecode, I bet it wouldn't be to hard to catch it midway. (You wouldn't even need to change the language, you could just write a C extention that could be imported seprately, and have it redirect stdout to the IO pins. Just a thought.)
  • Heater.Heater. Posts: 21,230
    edited 2010-09-07 22:02
    QUARKSPIN:
    Isn't there a C compiler for the prop?

    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.
    I heard somewhere that C++ converts into C before it compiles into bytecode,

    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.
    ... and have it redirect stdout to the IO pins....

    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.
  • scherreyscherrey Posts: 1
    edited 2010-10-26 15:48
    QUARKSPIN wrote: »
    I would give 100 million kudos to whoever does this. Isn't there a C compiler for the prop? I heard somewhere that C++ converts into C before it compiles into bytecode, I bet it wouldn't be to hard to catch it midway. (You wouldn't even need to change the language, you could just write a C extention that could be imported seprately, and have it redirect stdout to the IO pins. Just a thought.)

    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/
  • Heater.Heater. Posts: 21,230
    edited 2010-10-26 22:06
    Bill Henning:
    Spin is actually fairly similar to Python.

    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.
Sign In or Register to comment.