Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Opaque declarations, and measure and reset operations.
The instructions of QASM are classified in a hierarchy, I've tried to implement them in the form of several enums but extending enums is not supported in Rust (yet). https://stackoverflow.com/questions/25214064/can-i-extend-an-enum-with-additional-values The hierarchy is mostly related to QuantumOperation and UnitaryOperation. A UnitaryOperation is always a QuantumOperation but not the other way around. I went for the wrapping alternative which will make getting the value a bit tedious. I hope to be able of implementing some traits to ease this task but without rust-lang/rfcs#1450 it could be difficult. In reality, this hierarchy is not strictly neccessary, I could have grouped all the instructions in the same enum and let the grammar accept those programas that use the different operations correctly, but I wanted to experiment with a proper separation of instruction types. Let's see. Perhaps, a different approach would be following this Thin Traits proposal: http://smallcultfollowing.com/babysteps/blog/2015/10/08/virtual-structs-part-4-extended-enums-and-thin-traits/
- Loading branch information