Skip to content

mnikander/ir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

362 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Intermediate Representation

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.

Getting Started

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

Commit Message Hook

This repo includes a tracked commit-msg hook in .githooks/ that enforces commit messages to start with one of these tags:

  • impl for implementations of features
  • gen for AI-generated features
  • fix
  • ref for refactoring
  • test
  • doc
  • tool for linters, git config, CI/CD etc
  • proto for prototyping (could also use impl/gen instead)

Enable it once per clone with:

git config core.hooksPath .githooks
chmod +x .githooks/commit-msg

Accepted examples:

impl: stack underflow check
fix(runtime): correct program counter update
doc: clarify SSA invariants

More Information


Copyright (c) 2026 Marco Nikander

About

interpreter for an intermediate representation based on three-address code (3AC) and static single-assignment (SSA) form

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages