First Devlog
I’ve started work on Quell again!
Technically this isn’t the first version of the project, but the previous codebase had accumulated enough interesting choices that rewriting would be easier than fixing it (beautiful spaghetti code). The goal this time is to keep the soul of quell while remaking the project.
What is Quell?
Quell is a functional programming language designed to combine classical and quantum computing in a single language.
Rather than using an existing quantum backend, I’m also building my own execution backend (fun :D). The plan is for it to contain both a quantum simulator and a classical virtual machine, which is either a great idea or a something that will cost me a lot of time.
Programs will eventually compile from .ql source files into a low-level .q intermediate representation, which can then be executed by the backend.
What got done?
Most of this week was spent laying foundations:
- Set up the repository
- Created the CMake configuration
- Designed the initial backend instruction set
- Drafted the formal grammar for Quell
The backend is currently my main focus. Before writing much of the compiler, I want the VM and quantum execution layer capable of executing .q programs directly.
Qubit Implementation
One decision I’ve been thinking about is how qubits should be represented.
Internally, qubits will live inside registers. If a single qubit gets defined on its own, it’ll just be a register containing one qubit.
Therefore:
let q0: qubit = new qubit();
creates a new single-qubit register.
Meanwhile:
let q0: qubit = qreg[0];
doesn’t allocate anything. Instead, q0 becomes a reference to an existing qubit inside another register.
This keeps allocation based around registers while still making individual qubits easy to work with if people want to.
Backend Instruction Set
The backend currently supports a small native gate set:
- I
- H, X, Y, Z
- S, SDG
- T, TDG
- RX, RY, RZ
- PHASE
- CX
More complex gates such as CZ and SWAP will be lowered into simpler operations during compilation.
The backend also includes measurement, reset operations, classical arithmetic, comparisons, branching, and a call stack capable of supporting recursive functions.
What’s Next?
The next major milestone is getting the backend to execute .q files correctly.
After that, I want to:
- Finish dynamic qubit allocation
- Implement parsing and AST generation
- Begin lowering Quell source code into
.q - Start building out the type system and semantic analysis (much difficult)
I’ve also linked the current grammar below, for those of you who like stuff like that. It’s still in progress, but it’s in a better place where I can start implementing it later (now is backend time).