{"library":"nativejs-compiler","title":"nativejs-compiler","description":"nativejs-compiler (also known as hardware.js) is a JavaScript/TypeScript to C transpiler that converts JS/TS code into readable C89 code for low-power microcontrollers and IoT devices. Current version 2.0.0 (released July 2024) supports approximately 50% of ES3 syntax, targeting environments with very limited memory (512 bytes to 120KB RAM). Key differentiators include generating minimal, readable C code without unnecessary overhead, and employing escape analysis for memory management. It supports basic ES3 features like var, if-else, loops, functions, arrays, strings, and some built-in objects, but notably lacks support for float numbers, `this`, `new`, and `typeof`. Releases are occasional, focused on incremental feature coverage. Compared to other JS-to-C transpilers, it prioritizes output readability and small footprint over full language support.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install nativejs-compiler"],"cli":{"name":"nativejs-compiler","version":null}},"imports":["import { transpile } from 'nativejs-compiler'","import { compile } from 'nativejs-compiler'","import type { CompilerConfig } from 'nativejs-compiler'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { transpile } from 'nativejs-compiler';\nconst jsCode = `console.log(\"Hello world!\");`;\nconst cCode = transpile(jsCode);\nconsole.log(cCode);\n// Output:\n// #include <stdio.h>\n// int main() {\n//     printf(\"Hello world!\\n\");\n//     return 0;\n// }","lang":"typescript","description":"Transpiles a simple JavaScript 'Hello world' console.log to C code using the transpile function.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}