Quantum computing simulator with OpenQASM.
go install github.com/itsubaki/qasm@latest% qasm -help
Usage of qasm:
-f string
filepath
-lex
Lex the input into a sequence of tokens
-parse
Parse the input and convert it into an AST (abstract syntax tree)
-repl
REPL(read-eval-print loop) mode% qasm < testdata/bell.qasm
[00][ 0]( 0.7071 0.0000i): 0.5000
[11][ 3]( 0.7071 0.0000i): 0.5000
const : map[]
variable : map[]
bit : map[]
qubit : map[q:[0 1]]
gate : [cx h i x y z]
subroutine: []% qasm -repl
>> OPENQASM 3.0;
>>
>> qubit[2] q;
[00][ 0]( 1.0000 0.0000i): 1.0000
>> U(pi/2, 0, pi) q[0];
[00][ 0]( 0.7071 0.0000i): 0.5000
[10][ 2]( 0.7071 0.0000i): 0.5000
>> ctrl @ U(pi, 0, pi) q[0], q[1];
[00][ 0]( 0.7071 0.0000i): 0.5000
[11][ 3]( 0.7071 0.0000i): 0.5000% qasm -repl
>> OPENQASM 3.0;
>>
>> const float ratio = pi;
>>
>> int n = 2;
>> if (n > 0) { n = n*ratio; }
>>
>> print;
const : map[ratio:3.141592653589793]
variable : map[n:6.283185307179586]
bit : map[]
qubit : map[]
gate : []
subroutine: []