LO - Low level programming language for WASM with focus on simplicity
🧾 Parts [0..6] - Building the initial compiler. (text based blog)
📺 Parts [7..] - Building the self-hosted compiler. (YouTube playlist)
- Hello world (source):
- Advent of Code 2020 Day 1 (source):
This option also works in vscode.dev
- Install the LO VS Code extension
- To run currently open file: Command Palette:
LO: Run current file
, or press▶️ button in the top toolbar - Compiling files:
- Open Web Shell using Command Palette:
Terminal: Create New Web Shell
- Run:
run lo.wasm <input>.lo > <output>.wasm
- Open Web Shell using Command Palette:
- Install wasmtime
- Compiling files:
wasmtime --dir=. lo.wasm <input>.lo > <output>.wasm
- Getting diagnostics (in json format):
wasmtime --dir=. lo.wasm <input>.lo --inspect
- Install Node.js
- Compiling files:
./utils.mjs compile <input>.lo > <output>.wasm
- Compiling & running files:
./utils.mjs run <input>.lo
-
Requirements:
- Install rustup
- Switch to nightly:
rustup toolchain install nightly
- Add WASM target:
rustup target add wasm32-unknown-unknown
- You can also find configs for GitHub Codespaces and GitPod in this repo
-
Run
./build.sh
This will build the compiler with cargo, putting resulting WASM binary into
lo.wasm
-
Requirements:
- Install Node.js for running tests
-
Run
./utils.mjs test
This runs tests defined in
utils.mjs
. Test programs are located inexamples/test