{"slug": "a-self-hosting-compiler-and-bare-metal-os-written-entirely-in-javascript", "title": "A self-hosting compiler and bare-metal OS, written entirely in JavaScript", "summary": "A developer released a self-hosting JavaScript compiler and bare-metal operating system written entirely in JavaScript, comprising 55,700 lines of code and passing 1,214 tests across x86-64 and AArch64. The compiler emits native x86-64 and AArch64 machine code with no interpreter, VM, or libc, compiles itself, and produces byte-for-byte identical ELF output to the Bun-hosted compiler, while the kernel boots on QEMU and VMware via GRUB with a GUI window manager, ext2 filesystem, TCP/IP networking, TLS 1.3, a Bourne shell, fork/exec, and a built-in Claude AI assistant with 10 agentic tools. The project omits async/await, generators, and regular expressions.", "body_md": "A self-hosting JavaScript compiler and bare-metal OS, written entirely in JavaScript. Compiles JS to native x86-64 and AArch64 machine code — no interpreter, no VM, no libc. The compiler compiles itself. The OS boots on real hardware.\n\n``` js\nimport { compileToLinuxExe } from './src/compiler/pipeline.js';\nimport { writeFileSync } from 'fs';\n\nwriteFileSync('hello', compileToLinuxExe(`\n  function fib(n) {\n    if (n < 2) return n;\n    return fib(n - 1) + fib(n - 2);\n  }\n  console.log(fib(30));\n`));\n// chmod +x hello && ./hello  → 832040\n```\n\n55,700 lines of JS. 1,214 tests. The natively-compiled compiler produces byte-for-byte identical ELF output to the Bun-hosted compiler. The kernel boots on QEMU and VMware via GRUB, with a GUI window manager, ext2 filesystem, full TCP/IP networking, TLS 1.3 encryption, a Bourne shell, fork/exec, and a built-in Claude AI assistant with 10 agentic tools.\n\n```\nbun install\nbun test                    # 1,214 tests, both architectures\njs\n# x86-64 (runs natively on Linux x86-64)\nbun -e '\n  import { compileToLinuxExe } from \"./src/compiler/pipeline.js\";\n  import { writeFileSync } from \"fs\";\n  writeFileSync(\"out\", compileToLinuxExe(\"console.log(6 * 7);\"));\n'\nchmod +x out && ./out   # 42\n\n# AArch64 (requires qemu-aarch64-static on x86 hosts)\nbun -e '\n  import { compileToLinuxExeAArch64 } from \"./src/compiler/pipeline.js\";\n  import { writeFileSync } from \"fs\";\n  writeFileSync(\"out\", compileToLinuxExeAArch64(\"console.log(6 * 7);\"));\n'\nchmod +x out && qemu-aarch64-static ./out   # 42\nbun run tools/build-kernel.js                    # build kernel image\nbash tools/make-iso.sh                           # create GRUB bootable ISO\n\n# QEMU (serial I/O on stdio)\nqemu-system-x86_64 -kernel build/ungodly.bin \\\n  -vga std -serial stdio -m 256 -no-reboot\n\n# With disk + networking\nqemu-system-x86_64 -cdrom build/ungodly.iso \\\n  -vga std -serial stdio -m 256 -no-reboot \\\n  -drive file=disk.img,format=raw,if=none,id=disk0 \\\n  -device ahci,id=ahci -device ide-hd,drive=disk0,bus=ahci.0 \\\n  -netdev user,id=net0 -device e1000,netdev=net0\n```\n\n| Feature | Example | Status | \n|---|---|---|\n| Integer + float arithmetic | `(10.5 + 5) * 2 - 7` | done | \n| Variables, scoping | `let x = 42; const y = x + 1;` | done | \n| All operators | `a > b ? a : b` ,`x ?? y` ,`a?.b` | done | \n| Bitwise ops | `0xFF & 0x0F` ,`x << 3` ,`n >>> 0` | done | \n| All loop types | `while` ,`for` ,`for-in` ,`for-of` ,`do-while` | done | \n| Functions + recursion | `function fib(n) { ... }` | done | \n| Arrow functions | `const f = (x) => x * 2;` | done | \n| Closures + mutable captures | `let x = 0; function inc() { x++; }` | done | \n| Objects + prototypes | `let o = { x: 1 }; o.x = 2;` | done | \n| Arrays + methods | `push` ,`map` ,`filter` ,`reduce` ,`sort` ,`find` , ... | done | \n| Strings + methods | concat, `slice` ,`indexOf` ,`charCodeAt` , template literals | done | \n| Classes + inheritance | `class Foo extends Bar { ... }` | done | \n| `new` + constructors | `new Point(1, 2)` | done | \n| `this` binding | methods, constructors, arrow `this` capture | done | \n| Destructuring | `let { a, b } = obj; let [x, y] = arr;` | done | \n| Switch + break | `switch (x) { case 1: ... }` | done | \n| Throw / try-catch | `throw new Error(\"msg\")` ,`try { ... } catch (e) { ... }` | done | \n| `typeof` ,`instanceof` | `typeof x === \"string\"` | done | \n| `console.log` | multi-arg, all value types | done | \n| Garbage collection | Cheney semi-space, conservative stack scanning | done | \n| String interning | `\"hello\" === \"hello\"` → pointer compare | done | \n| NaN-boxing | int32 fast path, f64 fallback, pointer-biased | done | \n| AArch64 cross-compile | same JS → ARM64 binary | done | \n| Optimization passes | DCE, constant folding, GVN, type specialization | done | \n| Self-hosting | compiler compiles itself, byte-for-byte identical | done | \n| Promises + microtasks | `new Promise(...)` ,`.then()` , microtask queue | done | \n\n- No `async/await` , generators\n- No regular expressions\n- No modules (`import` /`export` ) — worked around by file concatenation\n- No `Proxy` ,`Reflect` ,`Symbol` ,`WeakMap` /`WeakSet`\n- No getters/setters\n- No private class fields\n\n```\nJS source\n  │\n  ▼\n┌──────────────────┐\n│  Parser           │  Recursive-descent, ES2023 subset, ESTree AST\n│  parser.js        │  1,510 lines\n└────────┬─────────┘\n         │ AST\n         ▼\n┌──────────────────┐\n│  Lowering         │  AST → SSA IR with basic blocks, phi nodes\n│  lower.js         │  NaN-boxing, closure capture analysis,\n│                   │  mutable capture box cells, 30+ builtin interceptions\n│                   │  3,831 lines\n└────────┬─────────┘\n         │ IRFunction (SSA, 196 opcodes)\n         ▼\n┌──────────────────┐\n│  Optimization     │  constFold → DCE → typeSpec → constFold → GVN → DCE\n│  optimize/        │  914 lines\n└────────┬─────────┘\n         │ optimized IR\n         ▼\n┌──────────────────┐\n│  Register Alloc   │  Linear scan on SSA live intervals\n│  regalloc.js      │  Dataflow liveness, call-aware spilling\n│                   │  397 lines\n└────────┬─────────┘\n         │ allocation map\n         ▼\n┌──────────────────┐\n│  Instruction Sel  │  IR → native machine code + runtime helpers\n│  x86_64/isel.js   │  6,296 lines — System V ABI, 30+ __rt_* helpers\n│  aarch64/isel.js  │  4,746 lines — AAPCS64, full feature parity\n└────────┬─────────┘\n         │ machine code bytes\n         ▼\n┌──────────────────┐\n│  ELF Linker       │  ELF64 builder, single LOAD segment\n│  elf.js           │  x86_64 + aarch64 + flat binary output\n└────────┬─────────┘\n         │\n         ▼\n    Linux ELF binary    — or —    Bare-metal kernel image\nPointers:    0x0000_PPPP_PPPP_PPPP   (raw, zero-cost dereference)\nInt32:       0xFFFF_0000_IIII_IIII   (tagged, extract with mask)\nDouble:      raw IEEE754 + 0x0002_0000_0000_0000 (bias)\nBoolean:     false = 0x06, true = 0x07\nNull:        0x02\nUndefined:   0x0A\n```\n\nFlat inline storage, no hash table. Up to 128 properties per object.\n\n```\n[GC header: u64] [num_props: u64] [key0: u64] [val0: u64] [key1: u64] [val1: u64] ...\n```\n\nProperty names are hashed at compile time (djb2 with high bit set). Lookup is linear scan.\n\nCheney semi-space collector. Two 256MB semispaces allocated via `mmap` (14MB on bare metal). Bump allocation into the from-space; when full, copy reachable objects to the to-space and swap. Conservative stack scanning for roots. GC control block pinned in R13 (x86-64) / X25 (AArch64). Bump pointer in R15 / X28.\n\nHeader format: `(totalSize << 17) | (numScannable << 5) | (tag << 1) | 1`\n\nTags: CLOSURE=0, OBJECT=1, STRING=2, ARRAY=3, BOX=4.\n\n```\n[GC header: 8] [code_ptr: 8 bytes] [capture0: 8] [capture1: 8] ...\n```\n\nClosure pointer passed in pinned register (R14 on x86-64, X26 on AArch64). Captures accessed as `[closure_reg + 8 * (1 + slot)]`.\n\nMutable captures use heap-allocated box cells (`GC_TAG_BOX`). A box is a 24-byte GC object: `[GC header: 8] [value: 8] [pad: 8]`. Both the outer scope and all capturing closures share the same box, reading and writing through it. The lowerer's pre-analysis pass (`_preAnalyzeMutableCaptures`) identifies which variables need boxing.\n\nTwo representations:\n\n- **Data-segment strings** :`[length: u64] [bytes...]` — embedded in code section, interned\n- **Heap strings** :`[GC header: u64] [length: u64] [bytes...]` — allocated by concat/slice\n\n```\nsrc/\n  compiler/\n    parser/\n      parser.js          Recursive-descent ES2023 subset parser (1,510 lines)\n      token.js           Token types\n    ir/\n      opcodes.js         196 IR opcodes with metadata flags\n      types.js           IR type system (i32, i64, f64, ptr, jsval, bool)\n      builder.js         IRFunction, BasicBlock, instruction pool\n    lowering/\n      lower.js           AST → IR, scope analysis, closure capture (3,831 lines)\n    codegen/\n      regalloc.js        Linear scan register allocator (397 lines)\n      i64.js             64-bit integer arithmetic (no BigInt)\n      x86_64/\n        regs.js          x86-64 register definitions, System V ABI\n        assembler.js     x86-64 instruction encoder (904 lines)\n        isel.js          IR → x86-64 instruction selection (6,296 lines)\n      aarch64/\n        regs.js          AArch64 register definitions, AAPCS64\n        assembler.js     AArch64 instruction encoder (716 lines)\n        isel.js          IR → AArch64 instruction selection (4,746 lines)\n    optimize/\n      dce.js             Dead code elimination\n      constfold.js       Constant folding + branch simplification\n      gvn.js             Global value numbering (CSE)\n      typespec.js        Type specialization (int32 inference)\n      utils.js           Shared optimization utilities\n    linker/\n      elf.js             ELF64 builder + flat binary output\n    pipeline.js          Main entry: source → ELF (601 lines)\n  kernel/                67 files, 33,200 lines\n    main.js              Kernel entry, event loop, window manager (1,472 lines)\n    drivers/\n      serial.js          COM1 serial I/O\n      vga.js             VGA text mode + framebuffer (800x600x32, PSF font)\n      keyboard.js        PS/2 keyboard ISR\n      mouse.js           PS/2 mouse driver\n      pci.js             PCI bus enumeration\n      pty.js             Pseudo-terminal (PTY) for terminal emulator\n      e1000.js           Intel e1000 NIC driver\n      ahci.js            AHCI SATA disk driver\n      vmware.js          VMware Tools guest agent\n      usb_scan.js        USB device enumeration\n      xhci_core.js       xHCI host controller\n      xhci_keyboard.js   USB keyboard via xHCI\n    fs/\n      ext2.js            ext2 filesystem (read/write, inode/block alloc, symlinks)\n      ramdisk.js         Embedded ramdisk archive\n      vfs.js             Virtual filesystem layer (10 FD types)\n      pipe.js            Pipe IPC (fork/exec stdin piping)\n    net/\n      net.js             Ethernet/IPv4/ARP/ICMP stack\n      tcp.js             TCP (3-way handshake, sliding window, retransmit)\n      udp.js             UDP\n      dhcp.js            DHCP client (auto-configure IP/gateway/DNS)\n      dns.js             DNS resolver\n      http.js            HTTP/1.1 client + HTTPS (TLS 1.3)\n      claude_api.js      Claude API client (SSE streaming, agentic tool loop)\n      oauth.js           OAuth 2.0 device code flow\n    crypto/\n      chacha.js          ChaCha20-Poly1305 AEAD + X25519 key exchange\n      sha256.js          SHA-256 + HMAC-SHA256 + HKDF\n      tls.js             TLS 1.3 handshake + record layer (ChaCha20-Poly1305-SHA256)\n    lib/\n      json.js            JSON parser (arena-based)\n      sse.js             Server-Sent Events parser\n      microtask.js       Microtask queue (Promise resolution)\n      promise.js         Promise implementation\n    tools/\n      tools.js           10 Claude tools (read/write/list/edit/search/exec/glob/fetch/search_web)\n    syscall/\n      dispatch.js        Linux syscall trampoline (60+ syscalls)\n      dir_ops.js         Directory syscalls (mkdir, rmdir, rename, getdents64)\n      file_ops.js        File syscalls (open, read, write, stat, symlinks)\n      socket_ops.js      Socket syscalls\n    shell/\n      eval.js            JIT eval (compile JS → native → execute at runtime)\n      commands.js        Shell command dispatch (sub-dispatcher pattern)\n      dispatch.js        Shell dispatch router\n      claude_cmd.js      Claude AI shell integration (agentic loop)\n      oauth_cmd.js       OAuth authentication commands\n      eval_expr.js       Expression evaluator (arithmetic, precedence)\n      exec.js            Process execution (fork, exec, wait)\n      fs_cmds.js         Filesystem shell commands\n      net_cmds.js        Network shell commands\n      proc_cmds.js       Process shell commands\n      misc_cmds.js       Miscellaneous commands\n      vfs_cmds.js        VFS shell commands (fd, open, close, pipe)\n      vga_helpers.js     VGA output helpers\n      sh_lexer.js        Bourne shell lexer\n      sh_parser.js       Bourne shell parser\n      sh_exec.js         Bourne shell execution\n      sh_runner.js       Bourne shell runner\n      sh_shell.js        Bourne shell main loop\n      sh_control.js      Bourne shell control flow (if/while/for)\n    proc/\n      pmm.js             Physical memory manager (bitmap allocator)\n      vmm.js             Virtual memory (page tables, 4-level paging)\n      process.js         Process table + context switching\n      elf.js             ELF loader (static-PIE binaries, ring 3 exec)\n  runtime/\n    value.js             NaN-boxing encode/decode/type checks\n\ntools/\n  build-kernel.js        Boot image builder (Multiboot, ISRs, page tables, 4,439 lines)\n  make-iso.sh            GRUB bootable ISO creator\n\ntests/                   1,214 tests across 23 test files\n```\n\nThe kernel boots via Multiboot1 (GRUB or QEMU `-kernel`), sets up 4-level paging, SSE, PIT timer at 100 Hz, PS/2 keyboard + mouse ISRs, and enters a GUI window manager with terminal emulator. The embedded compiler (19 files, ~18K lines) enables JIT evaluation of arbitrary JS at the shell prompt.\n\nCompositing window manager with mouse-driven drag/resize, terminal emulator with PTY backend, VGA framebuffer at 800x600x32.\n\n55+ commands including:\n\n| Command | Description | \n|---|---|\n| `help` | List available commands | \n| `eval <expr>` | JIT-compile and execute JavaScript | \n| `run <path.js>` | JIT compile + execute JS file from ext2 | \n| `exec <path>` | Execute ELF binary (fork + exec) | \n| `sh` | Enter Bourne shell mode | \n| `cls` | Clear screen | \n| `mem` | Show memory usage (GC heap, PMM) | \n| `ps` | List processes | \n| `kill <pid>` | Kill process | \n| `ls [path]` | List directory contents (ext2) | \n| `cat <path>` | Print file contents | \n| `echo text > file` | Write/append with redirection | \n| `cp <src> <dst>` | Copy file | \n| `mv <src> <dst>` | Rename/move file | \n| `mkdir <path>` | Create directory | \n| `rm <path>` | Remove file/directory | \n| `stat <path>` | Show file metadata | \n| `head <path> [n]` | Print first N lines | \n| `wc <path>` | Word/line/byte count | \n| `hexdump <path>` | Hex dump file contents | \n| `fd` | List open file descriptors | \n| `open/close/readfd/writefd/pipe` | Low-level FD operations | \n| `pci` | List PCI devices | \n| `disk` | Show disk info (AHCI) | \n| `net` | Show network configuration | \n| `ping <ip>` | Send ICMP echo request | \n| `dhcp` | Auto-configure network via DHCP | \n| `dns <hostname>` | Resolve hostname via DNS | \n| `http <url>` | HTTP GET request | \n| `tcp <host> <port>` | Open TCP connection | \n| `apikey <key>` | Set Claude API key | \n| `claude <msg>` | Send message to Claude (streaming) | \n| `claude` | Enter interactive Claude session | \n| `oauth github` | Authenticate via OAuth 2.0 device flow | \n\nBuilt-in `sh` command launches a Bourne-compatible shell with:\n\n- Pipelines (`cmd1 | cmd2 | cmd3` )\n- Redirections (`>` ,`>>` ,`<` )\n- Control flow (`if/then/elif/else/fi` ,`while/do/done` ,`for/in/do/done` )\n- Variables and substitution (`$VAR` ,`$(command)` )\n- Quoting (`\"double\"` ,`'single'` ,`\\escape` )\n\n60+ Linux syscalls via SYSCALL instruction, enabling execution of unmodified static-PIE musl binaries in ring 3:\n\n- Process: fork(57), wait4(61), exit(60), exit_group(231), clone(56)\n- Files: open(2), openat(257), read(0), write(1), close(3), stat(4), fstat(5), lstat(6), lseek(8), readv(19), writev(20), pread64(17), getdents64(217), readlink(89), dup(32), dup2(33), dup3(292), fcntl(72), access(21), unlink(87), pipe2(293)\n- Directories: mkdir(83), rmdir(84), rename(82), mkdirat(258), unlinkat(263), renameat(264), chdir(80), getcwd(79)\n- Memory: mmap(9), mprotect(10), munmap(11), brk(12)\n- Sockets: socket(41), connect(42), accept(43), sendto(44), recvfrom(45), bind(49), listen(50), setsockopt(54), getsockopt(55), accept4(288)\n- Epoll: epoll_create1(291), epoll_ctl(233), epoll_wait(232)\n- Signals: rt_sigaction(13), rt_sigprocmask(14), sigaltstack(131)\n- Time: gettimeofday(96), clock_gettime(228), nanosleep(35)\n- Misc: ioctl(16), poll(7), futex(202), statx(332), getrandom(318)\n\nQuickJS runs on unGodly (822KB static-pie musl binary — fibonacci, closures, classes, Array ops all pass).\n\nFull TCP/IP stack implemented from scratch in JS, running on bare metal:\n\n- **Link layer** : Intel e1000 NIC driver (MMIO, descriptor rings, interrupt-driven)\n- **Network layer** : IPv4, ARP (cache + request/reply), ICMP (ping)\n- **Transport layer** : UDP, TCP (16 connections, 3-way handshake, sliding window, retransmit, FIN teardown)\n- **Application layer** : DHCP client, DNS resolver, HTTP/1.1 client, HTTPS (TLS 1.3), fetch_url (redirect following), web_search (DuckDuckGo)\n\nAll crypto implemented from scratch in JS with integer-only arithmetic (no floats, no BigInt):\n\n- **ChaCha20** : 256-bit stream cipher (quarter-round, 20 rounds)\n- **Poly1305** : MAC authenticator (modular arithmetic mod 2^130 - 5)\n- **ChaCha20-Poly1305** : AEAD construction (RFC 8439)\n- **X25519** : Elliptic-curve Diffie-Hellman key exchange\n- **SHA-256** : Hash function + HMAC-SHA256 + HKDF-SHA256\n- **TLS 1.3** : Full handshake (ClientHello → ServerHello → encrypted application data)\n\nThe kernel includes a Claude API client that communicates over TLS 1.3. It supports:\n\n- Streaming responses via Server-Sent Events (non-blocking, GUI stays responsive)\n- Agentic tool loop with 10 tools: read_file, write_file, list_files, edit_file, search_files, execute_command, glob, fetch_url, web_search\n- fetch_url: HTTP/HTTPS GET with redirect following (301/302/303/307/308)\n- web_search: DuckDuckGo search with HTML-to-text stripping\n- Conversation persistence across messages\n- OAuth 2.0 device code flow for authentication\n- API key injection via `.env` file at build time\n\nCompiles JS source to a runnable x86-64 Linux ELF binary. Returns `Uint8Array`.\n\nCompiles JS source to a runnable AArch64 Linux ELF binary. Returns `Uint8Array`.\n\nCompiles JS source to raw machine code bytes. Options:\n\n- `arch` :`'x86_64'` (default) or`'aarch64'`\n- `name` : function name (default`'<main>'` )\n- `mode` :`'program'` (default) or`'function'`\n\nCompiles JS source to SSA IR. Returns an `IRFunction` object.\n\nCompiles to a raw flat binary (no ELF headers). Used for bare-metal targets.\n\nCompiles JS source with bare-metal intrinsics enabled. Sets up static GC heap, disables syscalls, enables `__outb`/`__inb`/`__peek`/`__poke`/`__hlt`/`__cli`/`__sti` intrinsics.\n\n-  **M1** — Minimal compiler (parser, IR, x86-64 codegen, ELF linker)\n-  **M2** — JS semantics (closures, objects, strings, NaN-boxing)\n-  **M3** — Optimization (DCE, constant folding, GVN, type specialization)\n-  **M4** — AArch64 backend (full feature parity)\n-  **M5** — Runtime built-ins (string/array methods, error handling)\n-  **M6** — Classes, prototypes,`for-of` , Map/Set polyfills\n-  **M7** — Self-hosting (true bootstrap — byte-for-byte identical ELF)\n\n-  **M1** — Boot on QEMU, VGA framebuffer, serial I/O, PS/2 keyboard\n-  **M2** — Interactive shell, JIT eval, expression evaluator\n-  **M3** — Memory manager (PMM/VMM), process model, context-switch scheduler, ELF loader\n-  **M4** — Storage (PCI enumeration, AHCI SATA driver, ext2 filesystem, ramdisk)\n-  **M5** — Networking (e1000 NIC, IPv4/ARP/ICMP, UDP, DHCP, DNS, TCP, HTTP)\n-  **M6** — Linux syscall compat (ring 3 exec, mmap/brk/read/write/exit, static-PIE binaries)\n-  **M7** — USB (xHCI host controller, USB keyboard)\n-  **M8** — HTTP client + JSON parser\n-  **M9** — Cryptography (ChaCha20-Poly1305, X25519, SHA-256, HMAC, HKDF)\n-  **M10** — TLS 1.3 (full handshake, encrypted record layer)\n-  **M11** — Claude API client (SSE streaming)\n-  **M12** — Tool system (file read/write/list/edit/search on ext2)\n-  **M13** — Claude shell integration (agentic tool loop, conversation persistence)\n-  **M14** — OAuth 2.0, VMware Tools, serial input, edit/search tools\n-  **M15** — Promises, microtask queue\n-  **M16** — Linux syscall trampoline (60+ syscalls), threading (clone/futex), sockets, epoll, fork/wait4\n-  **M17** — QuickJS on unGodly (musl static-pie)\n-  **M18** — Bourne shell (lexer, parser, pipelines, control flow, redirections)\n-  **M19** — Window manager + terminal emulator + REPL\n-  **M20** — execve + child_process.spawnSync, mkdir/rmdir/rename syscalls\n-  **M21** — Symlinks (ext2 inode type 0xA000, lstat, path resolution)\n-  **M22** — stdin piping via spawnSync, conservative fork stack copy\n-  **M23** — Non-blocking Claude streaming (PID 0 polling, GUI responsive during crypto)\n-  **M24** — HTTPS fetch for arbitrary URLs (TLS retry, X25519 precomputation, ALPN)\n-  **M25** — Tool dispatch fix (capture pressure reduction, 21 captures)\n-  **M26** — Advanced tools (execute_command, glob with recursive BFS)\n-  **M27** — Web tools (fetch_url with redirects, web_search via DuckDuckGo, HTML-to-text)\n\nMIT", "url": "https://wpnews.pro/news/a-self-hosting-compiler-and-bare-metal-os-written-entirely-in-javascript", "canonical_source": "https://github.com/Dyspel/unGodly", "published_at": "2026-12-03 22:40:31+00:00", "updated_at": "2026-12-03 22:46:22.955557+00:00", "lang": "en", "topics": ["artificial-intelligence", "ai-agents", "developer-tools"], "entities": ["JavaScript", "Bun", "QEMU", "VMware", "GRUB", "Claude", "x86-64", "AArch64"], "also_reported_by": [], "takeaway": "The compiler's compileToLinuxExe and compileToLinuxExeAArch64 functions turn JavaScript source into native ELF binaries for x86-64 and AArch64 with no interpreter, VM, or libc, and the self-hosted build matches the Bun-hosted compiler's output byte for byte.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/a-self-hosting-compiler-and-bare-metal-os-written-entirely-in-javascript", "markdown": "https://wpnews.pro/news/a-self-hosting-compiler-and-bare-metal-os-written-entirely-in-javascript.md", "text": "https://wpnews.pro/news/a-self-hosting-compiler-and-bare-metal-os-written-entirely-in-javascript.txt", "jsonld": "https://wpnews.pro/news/a-self-hosting-compiler-and-bare-metal-os-written-entirely-in-javascript.jsonld"}}