Quasar
Quasar is designed as a Domain Specific
Language embedded inside a Python programming language. It simplifies writing quantum
assembly code by translating high level if
statements into a sequence of controlled
quantum commands. It can be easily integrated with OpenQASM,
IBM Qiskit or Google Cirq.
Using Quasar you can write your quantum programs more easily and have them translated to a quantum assembly language automatically.
Python + Quasar
prgm = Program()
input_qubits = prgm.Qubits([0, 0, 0])
output_qubit = prgm.Qubit()
prgm += If(All(input_qubits)).Then(X(output_qubit))
Generated OpenQASM
OPENQASM 2.0;
include "qelib1.inc";
qreg q_registers[7];
creg c_registers[0];
ccx q_registers[0], q_registers[1], q_registers[5];
ccx q_registers[2], q_registers[5], q_registers[6];
cx q_registers[6], q_registers[4];
ccx q_registers[2], q_registers[5], q_registers[6];
ccx q_registers[0], q_registers[1], q_registers[5];
cx q_registers[4], q_registers[3];
ccx q_registers[0], q_registers[1], q_registers[5];
ccx q_registers[2], q_registers[5], q_registers[6];
cx q_registers[6], q_registers[4];
ccx q_registers[2], q_registers[5], q_registers[6];
ccx q_registers[0], q_registers[1], q_registers[5];