Not JIT but with XCompile - so: on the pseudo-fly.
As @Gordon pointed out in various posts, there is not enough memory to do JIT things of that magnitude - and speed would loose out for sure (that's why Espruino has its own unique engine, and not, for example Rhino, or V8,...). That approach also allows to just pick and choose what fits and makes sense, and grow over time gradually to full functionality - full meaning: everything that is very useful for the very platform at hand. It would though be possible to xcompile beforehand (in the Web IDE) and combine it with advanced minification. On the other hand, any of that kind technology makes it more difficult to exploit dedicatedly what a JS platform on a microchip has to offer. CoffeScript creates much more compact source code. In order to keep that going forward, the xcompiler needs to be aware of how the target JavaScript achieves similar effects, including minification. For simple constructs as found in CoffeScript's introduction, mapping looks trivial, and related overhead is predictable. What about nested closures? There is only that much of abstraction layering one can put on top of the core API before loosing touch with reality - that API. - 'It is just JavaScript' is easier understood than implemented.
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.
Not JIT but with XCompile - so: on the pseudo-fly.
As @Gordon pointed out in various posts, there is not enough memory to do JIT things of that magnitude - and speed would loose out for sure (that's why Espruino has its own unique engine, and not, for example Rhino, or V8,...). That approach also allows to just pick and choose what fits and makes sense, and grow over time gradually to full functionality - full meaning: everything that is very useful for the very platform at hand. It would though be possible to xcompile beforehand (in the Web IDE) and combine it with advanced minification. On the other hand, any of that kind technology makes it more difficult to exploit dedicatedly what a JS platform on a microchip has to offer. CoffeScript creates much more compact source code. In order to keep that going forward, the xcompiler needs to be aware of how the target JavaScript achieves similar effects, including minification. For simple constructs as found in CoffeScript's introduction, mapping looks trivial, and related overhead is predictable. What about nested closures? There is only that much of abstraction layering one can put on top of the core API before loosing touch with reality - that API. - 'It is just JavaScript' is easier understood than implemented.