kraM
A reversible programming language and gate compiler, written in Go.
- Repository
- github.com/PositiveControl/kraM
The project
A language whose programs run backward exactly, and a compiler backend that lowers them to elementary X, CNOT and Toffoli circuits. An equivalence checker verifies each compiled circuit against the interpreter across every basis state.
The circuits compile to OpenQASM and were run on IBM Quantum hardware, with measured fidelity recorded against the noise floor, including the runs that degraded.
At a glance
- Role
- Creator
- Stack
- Go, OpenQASM, IBM Quantum
- Status
- Built and validated on IBM Quantum hardware
How it was built
It started with pry. Debugging Ruby means stepping through a program as it runs, and kraM began as a language where a REPL could do that in both directions: step forward like pry, and walk the program backward. Making every step reversible led to elementary gates and circuits, the same building blocks quantum programs are made of. That is how the compiler came to target OpenQASM, and why its circuits were validated on IBM Quantum hardware.
kraM did not go through the chain: it was built in four days of direct commits, one language feature at a time, from an expression evaluator and a reversible execution core with a time-travel REPL up to the gate compiler and the quantum algorithms. Each algorithm carries its own tests, and each hardware run was committed as a result, with its QASM sample kept.