SharpCoder / fuzzyjs

embeddable javascript interpreter written in c++
MIT License
9 stars 0 forks source link

Maybe this is a good startup: JerryScript #1

Open snowyu opened 9 years ago

snowyu commented 9 years ago

JerryScript - https://github.com/Samsung/jerryscript JerryScript is the lightweight JavaScript engine intended to run on a very constrained devices

More reference: https://github.com/teamhost/creation

wish your rpi-kernel get more better.

lpsantil commented 9 years ago

Granted, x86_64 is not the primary target arch, but the smallest binary I built was something like 179KB with cesanta's v7. I couldn't even build jerryscript. And I've been building js VMs since 1998.

On Monday, August 3, 2015, Riceball LEE notifications@github.com wrote:

JerryScript - https://github.com/Samsung/jerryscript JerryScript is the lightweight JavaScript engine intended to run on a very constrained devices

  • Only few kilobytes of RAM available to the engine (<64 KB RAM)
  • Constrained ROM space for the code of the engine (<200 KB ROM)

More reference: https://github.com/teamhost/creation

wish your rpi-kernel get more better.

— Reply to this email directly or view it on GitHub https://github.com/SharpCoder/fuzzyjs/issues/1.

SharpCoder commented 9 years ago

Thank you both! I tried a few different JS engines, and none of them would work without heavily reliance on some kind of standard library, which makes sense haha. My project (fuzzyjs) has two goals. First, I want to run it on my raspberry pi kernel. Secondly, I was interested in the recursive descent parsing technique. So it was a win-win :)

That being said, this thing has turned out to be a monster of a project! I'll take a look at JerryScript and see what it needs. Maybe I'll glean some inspiration from it as well.

And in response to your comment @snowyu, I will be working on my kernel soon. I have a lot of improvements I plan to make. :D

snowyu commented 9 years ago

@lpsantil: The guy seems build the jerryscript on ubuntu only. the build target only for linux and stm. My favorite language is FORTH for MCU.I took it as a portable ASM(or bytecodes) and operating system for my personal interesting. The similar things get more and more. The .NET Micro Framework may be another option to build js engine on it.

@SharpCoder Write parser with peg/leg more easily.

lpsantil commented 9 years ago

@snowyu: I personally believe there is space and a need for something much like Tiny BASIC (a 2K/3K BASIC for 8-bit machines) and Forth that has some compatibility with the now huge base of JS code now available. I feel like the now withdrawn ECMAScript Compact Profile (ES-327) and "Restrict Mode JS" would good places to start to get the language and runtimes smaller, more manageable.

IMO, ES3 still has huge applicability even if VM implementers are currently distracted by ES5/6/7. And think our goals should be 16K code/16K RAM on 32-bit machines (though 16-bit machines should also be very feasible). I mean, Java CLDC pitched 160K ROM, 8K RAM on 16- or 32-bit machines, and Java IMP pitched 128K for Java Platform (libs?), 8K persistent data, and 32K for Java Runtime (VM?). .Net Micro Framework pitches 300K RAM.

snowyu commented 9 years ago

I think the [CIL(Common Intermediate Language)[https://en.wikipedia.org/wiki/Common_Intermediate_Language] is on the right direction, at least. the CIL is entirely stack-based. But it seems to be difficult cropped to fit my needs(maybe need a complete rewrite). At this point, another options are llvm, jvm.

for js I think the strong-type is required if wanna get the best performance and reduce size. The GC will be the second trouble on the MCU. The type inference may be a solver.