QuantumBFS/YaoBlocksQASM.jl

support QASM -> Blocks

Roger-luo opened this issue · 4 comments

currently missing QASM -> Blocks pass, you will need to define a qasm_str macro to support the syntax that YaoLang has.

I wonder what advantage would a macro have than a method. Since the qasm output is just a list, it's fairly simple to convert it back to blocks?

so what you actually want to have in the macro is to generate a new julia function that returns a block, when you see gate statements in the QASM AST.

Or you won't be able to support subroutines defined by QASM.

Though I am still not clear about how this macro should work, I am assuming something on the lines of https://github.com/QuantumBFS/YaoTargetQASM.jl/blob/master/src/frontend.jl???

The YaoTargetQASM implementation should be similiar to this one except that you don't need to support classical function and control flows, which makes things a lot simpler.

I'm expecting when you see a gate statement in QASM, convert it to a Julia function that returns the corresponding blocks, e.g consider how would you compile this file: https://github.com/QuantumBFS/YaoTargetQASM.jl/blob/master/test/qelib1.inc#L4