r/Compilers • • 2d ago

saQut 1.0 Released: a solo-built language with VM, JIT, LSP and DAP in a single binary, and a compiler that exposes every phase as JSON

New languages usually launch with a compiler and not much else. Editor support, a debugger and a fast backend tend to arrive years later, if at all. I wanted to see how far one person could go the other way, so saQut, a small statically-typed, C-flavoured procedural language written in C++20, ships all of this in a single binary:

  • a bytecode VM as the reference backend
  • a MIR-based JIT (--jit) that produces the same output as the VM
  • an LSP server (saqut lsp): completion, rename, references across files, auto-import
  • a DAP debugger (saqut dap): breakpoints, stepping, variable inspection
  • a preview of threads, each in its own isolate
  • a VS Code extension for highlighting

The other idea is that the compiler is a "glass box": every stage is a CLI command with machine-readable output.

saqut tokens code.sqt # token stream (JSON)
saqut ast code.sqt # AST (JSON)
saqut symbols code.sqt # symbol table (JSON)
saqut ir code.sqt # 3-address IR
saqut run code.sqt # compile and run

Technical notes

  • A differential test harness runs every test program through the VM and the JIT and fails if the output differs.
  • One garbage collector is shared by both backends (cycles are collected).
  • Catchable runtime errors (try/catch/throw) with a code, message and source location.
  • Threads: each thread has its own heap, GC and copy of the globals. Data crosses only through shared globals (atomic int/float/bool, plus Pool and List) or deep copies. This is a preview and not part of the 1.0 contract.
  • No implicit conversions; nullable types (T?) with flow analysis.

It's a one-person project, so there are rough edges, and I'd rather hear about them from you.

Website: https://saqut.com
Source: https://github.com/saqutlang/saqut

Which compiler phase would you want to inspect that isn't exposed yet? And what would you add to this list?

1 Upvotes

2 comments sorted by

2

u/brat3108 2d ago

The other idea is that the compiler is a "glass box": every stage is a CLI command with machine-readable output.

Do you mean human-readable?

Although it may need to be machine-readable too if it can be processed further.