function a(b) {
"compiled";
return b+"World";
}
console.log(a("Hello "))
Compiles to:
var ASM_BASE=process.memory().stackEndAddresÂs;
var ASM_BASE1=ASM_BASE+1/*thumb*/;
[0xb580,0xb401,0x9800,0xb401,0xa00b,0xbf00,0x4f09,0x697f,0xf000,0xf80e,0xb401,0x222b,0xbc02,0xbc01,0x4f05,0x68bf,0xf000,0xf806,0xb401,0xbc01,0xe7ff,0xbc08,0xbd80,0x4770,0x4738,0xbf00,0x74,0x2000,0x6f57,0x6c72,0x64,0x0].forEach(function(v) { poke16((ASM_BASE+=2)-2,v); });
var a = E.nativeCall(ASM_BASE1, "JsVar (JsVar)")
console.log(a("Hello "))
I doubt I'll get much more time to work on it over christmas, but it's looking very promising indeed. Needs a lot of tidying, and I've got to add calls to jsvUnLock and fake a 'frame pointer', but then I can start looking at things like control flow.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Another update. It now actually does stuff...
Compiles to:
Which does:
I doubt I'll get much more time to work on it over christmas, but it's looking very promising indeed. Needs a lot of tidying, and I've got to add calls to
jsvUnLock
and fake a 'frame pointer', but then I can start looking at things like control flow.