Q-Rust
A quantum transpiler written in Rust, designed to parse, analyze, and optimize quantum circuits.
Features
- Robust QASM 2.0 Support: Parse OpenQASM 2.0 files with full support for standard gates, parameterized rotations, and measurements.
- Modular Intermediate Representation (IR): A flexible, type-safe IR built for easy analysis and transformation.
- Graph-Based Backend Topology: Define custom hardware backends with arbitrary connectivity using efficient graph structures (
petgraph).
Error Handling
Q-Rust enforces strict OpenQASM 2.0 compliance. It will explicitly reject:
- OpenQASM 3.0: Files starting with
OPENQASM 3.0;will trigger anUnsupported OpenQASM versionerror. - Missing Headers: Files must start with a valid
OPENQASM 2.0;header. - Missing Measurements: The
Circuit::validate()method warns if a circuit has no measurements, as it will not produce output on real hardware.
Installation
Add to your Cargo.toml:
[]
= "0.1"
Usage
Parsing QASM
use parse_qasm;
Defining a Backend
use Backend;
References
This project adheres to the OpenQASM 2.0 specification:
- Specification: OpenQASM 2.0 on GitHub
- Paper: Andrew W. Cross, Lev S. Bishop, John A. Smolin, Jay M. Gambetta, "Open Quantum Assembly Language", arXiv:1707.03429
License
MIT or Apache-2.0