The elk project is developing a compact JavaScript engine for microcontrollers.

A new release of the JavaScript engine elk 2.0.9 is available, aimed at use in resource-constrained systems such as microcontrollers, including ESP32 and Arduino Nano boards with 2 KB of RAM and 30 KB of Flash. The provided virtual machine works with just 100 bytes of memory and 20 KB of storage space. The project's code is written in C and is distributed under the GPLv2 license. Only a C compiler is needed to build the project — no additional dependencies are used. The project is being developed by creators of the Mongoose OS for IoT devices, the mJS JavaScript engine, and embedded applications. web server Mongoose (used in products from companies like Siemens, Schneider Electric, Broadcom, Bosch, Google, Samsung, and Qualcomm).

The main purpose of Elk is to create firmware for microcontrollers in JavaScript that perform various automation tasks. The engine is also suitable for embedding JavaScript handlers into C/C++ applications. To use the engine in your code, you only need to place the file elk.c in the source tree, include the header file elk.h, and use the js_eval call. It allows calling functions defined in C/C++ code from JavaScript scripts and vice versa. The JavaScript code runs in a secure, isolated environment separate from the main code, using an interpreter that does not generate bytecode or use dynamic memory allocation.

Elk implements a small but sufficient subset of the Ecmascript 6 specification to create working scripts. In particular, it supports a basic set of operators and types, but does not support arrays, prototypes, this expressions, new, or delete. Instead of var and const, it's recommended to use let, and instead of do, switch, and for, use while. There is no standard library provided, meaning no such objects as Date, Regexp, Function, String, and Number.

Source: opennet.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster