+ 2
JavaScript for Arduino
I came up with the idea of building a JS compiler for AVR (the architecture of the Arduino microcontrollers), since JS is getting more and more popular. At first I thought that I should check out V8 engine and see if I can make it generate AVR machine code. What I found out was that V8 is a JIT compiler/interpreter. I am currently thinking of writing a new compiler from the ground up, since modifying V8 could be a lot of trouble. I believe that, even if I could make it generate binaries Ahead Of Time, it would still be difficult to customize it for such an architecture. Do you guys think that I should give V8 a try or go ahead and write a new compiler?
5 odpowiedzi
+ 2
You can't write a javascript compiler alone, it's just infeasible.
But what I do know is that javascript-on-microcontrollers has been done before, check out the Espruino!
+ 2
I found a thread about the reasons for which making a JS compiler is a pain.
https://news.ycombinator.com/item?id=10228904
+ 1
Schindlabua I just checked out Espruino. It uses an interpreter, instead of a compiler, and it doesn't support Arduino boards.
Seems like JS is very complex to get compiled AOT 😅
+ 1
You can use cylon.js module
https://cylonjs.com
0
magad I will definitely give this a try