What is it?
MetalScript compiles JavaScript to a firmware executable, to run natively on an embedded MCU, without the runtime overhead of an interpreter or operating system, or the complexity of external dependencies.
How does it work?
MetalScript is a command line tool that takes JavaScript source code and compiles it to native machine code for the corresponding target microcontroller architecture.
MetalScript is not an interpreter or bytecode virtual machine – the JavaScript you write is translated into machine code in a similar way to how C or C++ are translated into machine code, and executed natively.
How much RAM and ROM does it consume?
Like C, JavaScript requires a minimal runtime in order to operate. In C, the runtime library provides basic functions like strlen
and malloc
. In JavaScript, the runtime provides the event loop and garbage collector, which is small (less than 10kB of ROM and 1 kB of RAM).
The JavaScript specification also specifies a set of built-in objects, such as String
, Number
, Date
etc, but MetalScript treats these in a way that does not consume any resources of themselves, similarly to how the C++ standard template library does not consume any resources of itself. You only pay for what you use and how you use it.
What JavaScript features does it support?
MetalScript supports most features of ES6. It does not support eval
and relatives of eval
, since MetalScript is a compiler and does not provide the capability of executing dynamic code at runtime.
MetalScript is still under development
The MetalScript project is under development. The above points describe the design and intention of the project, and not measurable facts (yet).