The Qwerty Programming Language #
Qwerty is a new quantum programming language with no gates. Instead, Qwerty is basis-oriented.
Here is an implementation of the Bernstein–Vazirani algorithm in Qwerty:
import sys
from qwerty import *
def bv(secret_string):
@classical[N](secret_string)
def f(secret_string: bit[N], x: bit[N]) -> bit:
return (secret_string & x).xor_reduce()
@qpu[N](f)
def kernel(f: cfunc[N,1]) -> bit[N]:
return '+'[N] | f.phase \
| pm[N] >> std[N] \
| std[N].measure
return kernel()
secret_string = bit.from_str(sys.argv[1])
print(bv(secret_string))
Qwerty is embedded in Python, so invoking a Qwerty program is as easy as
python bv.py 1101
.
For more information, see:
- The Qwerty arXiv preprint, which motivates Qwerty, summarizes the language features, and describes many example programs
- The motivation for Qwerty
- Examples of Qwerty programs