Kraythorne has asked for the wisdom of the Perl Monks concerning the following question:

I know that you can write code for microcontrollers in C, but I wondered if there is anything out there that allows you to write it in perl?

The biggest problem I can see is getting the program compiled to Hex for downloading into the chip?

Replies are listed 'Best First'.
Re: Perl Programming Microcontrollers
by almut (Canon) on Apr 09, 2009 at 12:45 UTC

    I see (at least) two problems:

    • getting Perl code compiled at all into a resident image file (the perlcc project has been abandoned)
    • finding a port of Perl that supports your microcontroller.

    (Those dedicated C compilers typically emit machine code that's understood by the specific microcontroller...)

Re: Perl Programming Microcontrollers
by roboticus (Chancellor) on Apr 09, 2009 at 14:16 UTC
    Kraythorne:

    Short answer: No.

    Long answer: While much of the basics of the language could probably be compiled for a microcontroller, much of what makes perl so useful would be difficult (if possible) to make small enough for use in a microcontroller. You would have to make some serious compromises. Finally, it's said that "only perl can parse perl"1, so it would be a significant undertaking to write the compiler for it. I'm unaware of any attempts to write a compiler for perl that would target a microcontroller.

    ...roboticus
Re: Perl Programming Microcontrollers
by zentara (Cardinal) on Apr 09, 2009 at 18:45 UTC
    A better solution for Perl: but you need to buy a miniature motherboard on a chip, run an Operating System on it, then run Perl. :-) It won't be long before you have entirely solid state computers on a few stacked chips encapsulated in epoxy. Connect thru a fiberoptic cable/ethernet , and you have a miniature computer. It could output to a usb port or an IP address.

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku
      Or buy something like this

      4GB SSD, 12GB RAM and 1.2GHz processor for $99, and it fits in a wall wart.

      Update

      There's a better picture here

        Now that is awsome......now we just need cheap usb breadboards that we can hook actuators/sensors to. Sort of like the Basic Chip....version 2000...:-)

        I'm not really a human, but I play one on earth.
        Old Perl Programmer Haiku