JavaScript on the Propeller?
Heater.
Posts: 21,230
Continuing my current obsession with JavaScript I'd like to introduce you to this: http://www.espruino.com/
With an impressive demo video here: http://www.espruino.com/Video
It was only the other day that I was half joking here that one day we would be programming our tiny embedded systems in JS. Only to find that someone has already done it. Thanks to KC_Rob for the heads up on that.
That guys JS operates in 128K FLASH so it's not far off fitting in a PII. With an external memory it must be possible. He says he might open source the thing at some point only I have the horrible feeling he may have written it in ARM assembler.
With an impressive demo video here: http://www.espruino.com/Video
It was only the other day that I was half joking here that one day we would be programming our tiny embedded systems in JS. Only to find that someone has already done it. Thanks to KC_Rob for the heads up on that.
That guys JS operates in 128K FLASH so it's not far off fitting in a PII. With an external memory it must be possible. He says he might open source the thing at some point only I have the horrible feeling he may have written it in ARM assembler.
Comments
Seriously, I've been reading up on Node and learning JavaScript and with the little example you posted in the other thread, the bells and lights are starting to go off in my head. Wrapping your mind around the anonymous functions and call backs and event loop takes a bit but once it starts to click, woohooo!!! There are some really neat possibilities to blend everything together with JS superglue.
@mindrobots,
Great. Yes, I have managed to program for decades without anonymous functions, inner functions, closures. So it takes a bit of getting used to. The idea that local variables can still be valid after a function has exited is just freaky.
Never used recursion on an embedded system, I believe it was forbidden on many projects I have worked on.
Do you want a Dallas Systems DS80C400 Tini motherboard? I have three here and two have never been used. It is all Java, have a file system, has LAN, has a RTC, has a couple of serial ports, has 1-wire, has Canbus. It can even use I-Buttons.
http://www.maximintegrated.com/datasheet/index.mvp/id/4983
(somebody had to say it)
I agree. Crazy impossible. Wait a minute...
I just ordered my Olimexino STM32 so I can have something to compare the impossible to!
Let's see, now should I work on my taxes, work on the many, many other projects on my stack or allocate another stack frame and start playing with this silliness???
Could we be seeing evolution in action ...... Propeller --> PropGCC --> Raspberry Pi & Propeller --> Propeller 2 & Raspberry Pi --> PropJS --> Enlightened Systems
Guess what?
The TinyJS interpreter on Google code linked to above happens to be made by the same guy at Pur3 Ltd in the UK as the Espurino system in the video. Looks like he has not added all the hardware interfacing goodies to the version on Google code.
There is also a branch in that repository where someone has taken TinyJS and tried to make it more standards compliant. In the process it is has grown to over 8000 lines of code.
Anyway, TinyJS compiles fine on Linux out of the box and the resulting interpreter does actually work interactively.
I would compile it with propgcc but my machine with that on is tied up with farmville for hours (no I don't do that).
We are very close to JS on the Propeller.
Now, how best to make use of all the Props COGs and other goodies from JS?
What other thread? Did I miss another amazing Heater post?
Not so amazing. You did not miss much. It's here:
http://forums.parallax.com/showthread.php/147187-Calling-all-vb.net-experts-help-please!?p=1175210&viewfull=1#post1175210
I can't even remember how I came across Espruino the other day, but once I did, I knew that Heater must be informed (on the off-chance that he hadn't already seen it) -- that way he'd know that he wasn't so far out in left field after all.
The code examples do whet the appetite. Espruino looks promising.
Thanks for the offer for the Tini board. I'm going to decline. I have too may platforms to keep up with and to be honest Java is not on my favorites list.
Note: Java and JavaScript are very different languages. In some respects JavaScript has more advanced features than Java, like inner functions, anonymous functions, closures, prototypal inheritance... which makes it more interesting and makes up for it's interpreted nature.
Well it's a start.
I ran their hello, world example last week, but didn't have time to look for the serial interface stuff. Is "npm" like a Node Package Manager? Any chance you could start a thread for exploring Node + SerialPort and related things? I've missed how to plug the functions into html for example. Is there enough interest from others here?
I have plenty to do, but I'd like to learn more about this even in little pieces.
Thanks,
--Steve
http://forums.parallax.com/showthread.php/147256-Trying-to-build-TinyJS-for-the-Prop.
In Propeller land the impossible is done yesterday.
That's because there aren't any interruptions!!! :0)