An interpreter for an intermediate representation (IR). This IR is based on three-address code (3AC aka TAC) and static single-assignment (SSA) form. Like all IRs, it sits between high-level languages such as C or TypeScript on one end, and Assembly on the other end.
There is no parser. The input is in JSON form, not in text form. The JSON input is verified by the TypeScript type checker. There is a pretty-printer which can convert an HIR into text, for better readablity. HIR has type annotations for analysis; LIR does not.
This project is implemented in TypeScript, using Deno. After setting up deno, navigate into the directory of this repository and install the required dependencies using:
cd ir/
deno install
Build and run the tests with:
deno test
This repo includes a tracked commit-msg hook in .githooks/ that enforces
commit messages to start with one of these tags:
implfor implementations of featuresgenfor AI-generated featuresfixreffor refactoringtestdoctoolfor linters, git config, CI/CD etcprotofor prototyping (could also use impl/gen instead)
Enable it once per clone with:
git config core.hooksPath .githooks
chmod +x .githooks/commit-msgAccepted examples:
impl: stack underflow check
fix(runtime): correct program counter update
doc: clarify SSA invariants
- IR design
- Table of Instructions
- Log of design decisions for the interpreter and IR
- Overview which outlines the architecture and files
Copyright (c) 2026 Marco Nikander