This example demonstrates the core concept of compiling a simple JavaScript-like arithmetic expression into a low-level, stack-based Intermediate Representation (IR). It then simulates the execution of this IR using a minimalistic virtual machine, devoid of typical JavaScript runtime features like garbage collection or dynamic typing. This approach mirrors the article's goal of running JavaScript on bare-metal with a minimal footprint.
python
Save the code as main.py. Run from your terminal: python main.py
This example accompanies the Turkish article: JavaScript Sözdizimini LLVM IR Üzerinden Bare-Metal x86'ya Derlemek: Çalışma Zamanı Olmayan, Çöp Toplayıcısız, 64KB Unikernel Macerası.
MIT — see LICENSE.