Hacker Newsnew | past | comments | ask | show | jobs | submit | lprader's commentslogin

We can run our helloworld sample (https://github.com/Moddable-OpenSource/moddable/tree/public/...) with the xsbug debugger attached in 6000 bytes of RAM on the ESP8266. 5456 bytes for the stack and heaps, 256 for the dynamic symbol table, and 288 for the alias array.

With the 26KB RAM Duktape needs for "Hello world" we can run apps like the Sensor hub described in this blog post (run on a Thunderboard that only has 32KB of RAM total): http://blog.moddable.tech/blog/moddable-tech-presentation-to...


By default Duktape maintains the built-in objects purely in RAM, but for low footprint targets the built-in objects (and also custom user objects) can be made pure ROM objects which reduces memory usage quite a bit; the lowest startup RAM usage is around 1,5kB, see https://github.com/svaarala/duktape/blob/master/doc/low-memo....


Yeah, that would be interesting. Right now the Moddable SDK comes with the Piu application framework, which has cascading styles, inspired by CSS. You can read all about that here: https://github.com/Moddable-OpenSource/moddable/blob/public/...


A few things:

- XS7 can run in as little as 32K RAM :)

- Espruino follows the ES5 standard (released in 2009), whereas XS7 follows the ECMAScript 2017 standard.

- The Espruino debugger is more like gdb, the XS7 debugger has a GUI.

We have a couple of posts on our website with more information about XS7: http://blog.moddable.tech/blog/moddable-tech-presentation-to... http://www.moddable.com/XS7-TC-39


Yes, absolutely. XS just provides the basic built-in JavaScript objects (Date, RegExp, String, Number, etc.). Everything else is up to you (meaning the person who creates the virtual machine). And memory allocation can be static or dynamic, so you can control how much memory is available.

In case you're interested, here's the doc that describes the C interface to the runtime of the XS JavaScript engine: https://github.com/Moddable-OpenSource/moddable/blob/public/...


I didn’t see anything in that doc about limiting instructions executed, or throwing an error if some limit is reached. Did you mean to say that capability is included? Can you share a specific reference?


We don't have a document that answers your question directly but the capabilities are all there. We're happy to help you get started - post an issue on our repository on GitHub. The "XS in C" describes the API you'll use from your C/C++ code to interact with XS (created a VM, implement native functions callable from JavaScript, etc). Most of the limits can be set using the manifest, which defines the virtual machine build. For example, to limit the memory used by a script or the modules available to a script (e.g. what classes and functions it can call), use the manifest's "creation" object which indicates the maximum number of bytes the VM can allocate. Here's the base manifest all our examples include, which define the VM size in the creation as 32 KB - https://github.com/Moddable-OpenSource/moddable/blob/public/.... The manifest also lists all the modules that are built into the virtual machine. These are the only modules a script can use (unless you add a module that can load other modules!). For example, manifest_net.json (https://github.com/Moddable-OpenSource/moddable/blob/public/...) includes a bunch of modules related to networking (socket, sntp, wifi).


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: