2
NateTheGrappler/ Oli-Nat-Programming-Language-Docs-Playground
Docs and an in-browser playground for the Oli-Nat language
  • NateTheGrappler
NateTheGrappler
Oli-Nat Docs and Playground
September 5th, 2026|Github|Content
  • WebAssembly
  • MDX
  • Documentation
  • Cloudflare

Oli-Nat Programming Language

The documentation site and in-browser playground for the Oli-Nat programming language.

olinat.net · Playground · Language source


About

Oli-Nat is a small, statically typed programming language with a hand-written bytecode virtual machine, built from scratch in C. This repository is its home on the web: the documentation site and a playground where anyone can write and run Oli-Nat code without installing anything.

The playground doesn’t use a simplified version of the language or send code to a server. It runs the real C interpreter, compiled to WebAssembly, entirely in your browser.

The documentation goes beyond syntax. Alongside guides for using the language, it explains how each stage of the interpreter is implemented, from the scanner and Pratt parser to the type checker, virtual machine, and garbage collector.

Features

Tech Stack

Area Tools
Framework React 19, TypeScript, Vite
Routing React Router
Docs content MDX, remark-gfm for tables
Code highlighting Shiki via rehype-pretty-code
Editor CodeMirror via @uiw/react-codemirror
Interpreter Oli-Nat’s C source compiled with Emscripten
Linting oxlint

How the Playground Works

The Oli-Nat interpreter is plain C11 with no dependencies, so most of it compiles to WebAssembly unchanged. The playground loads the compiled module (src/WASM/Oli_Nat.mjs and Oli_Nat.wasm) and calls a single exported function, runFromSource, with the contents of the editor.

The interesting part is input. In a terminal, intake() reads a line with fgets and blocks until the user presses Enter. A web page can’t block like that without freezing the tab. The browser build replaces the read with an async JavaScript function and is compiled with Emscripten’s Asyncify, which lets the virtual machine:

  1. pause in the middle of running a program,
  2. hand control back to React while the user types into the terminal,
  3. resume exactly where it left off once they press Enter.

From the C code’s point of view, intake() is still an ordinary blocking call.

Output from the interpreter arrives through Emscripten’s print hooks. It’s buffered on the React side and flushed on each newline, and also right before an input prompt, so that print() without a newline still shows up correctly.

Getting Started

You’ll need Node.js (a current LTS release) and npm.

git clone https://github.com/NateTheGrappler/Oli-Nat-Programming-Language-Docs-Playground.git
cd Oli-Nat-Programming-Language-Docs-Playground
npm install
npm run dev

The site will be running at http://localhost:5173.

Command
npm run dev Start the development server with hot reloading
npm run build Type check and build the production site into dist/
npm run preview Serve the production build locally
npm run lint Lint the project with oxlint

Project Showcase

Common Tasks

Adding a documentation page

  1. Create an .mdx file in src/docs/<section-id>/, for example src/docs/guides/classes.mdx.

  2. Add an entry for it to that section’s pages array in src/config/sections.ts:

    { slug: 'classes', title: 'Classes' },

The slug must exactly match the file name, including capitalization. The page is then available at the section’s route plus the slug (for example /docs/guides/classes), and it appears in the sidebar automatically.

Adding a sample program

Drop an .oli file into src/testCases/. It’s picked up automatically and shown in the playground’s sample list, using the file name as its label.

Updating the interpreter

The files in src/WASM/ are build output from the language repository. After changing the C interpreter, rebuild it with Emscripten and copy both Oli_Nat.mjs and Oli_Nat.wasm into src/WASM/, always together. See the contributing guide for the full build steps.

Oli_Nat.d.mts is a hand-written TypeScript description of the module, and only needs updating if the exported runFromSource function changes.

Deployment

npm run build produces a fully static site in dist/ that can be hosted anywhere. Because routing happens on the client, the host must serve index.html for any path that doesn’t match a file, so that links like /docs/guides/types work when opened directly.

Contributing

Contributions are welcome, whether that’s fixing a typo, improving an explanation, adding a sample program, or working on the playground itself. Start with the contributing guide on the site, and feel free to open an issue to ask a question or suggest an idea before writing any code.

Changes to the language itself belong in the interpreter repository.

Acknowledgments

Oli-Nat’s virtual machine design is inspired by Robert Nystrom’s Crafting Interpreters. Thank you to everyone who has contributed test cases, bug fixes, and standard library additions to the language.