-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement parsing
measure
from text through ASG (#42)
* Partially implement parsing measure from text through ASG Statements like `c = measure q` are analyzed correctly. But `c[0] = measure q` is not analyzed correctly. The code that builds the assignment statement assumes the LHS is an identifier. The ASG should be able to handle valid lvalues. But we cannot yet construct statements with them. * Fix some minor errors found in code review * Factor code into from_gate_operand This is done twice and is several lines, so it is a function now. * Fix test in from_string_test This is unrelated to measurement. * Parse argument to `measure` as gate operand `GateOperand` is a qubit argument to gate call. And arguments to `measure` have the same spec. Identifier, hardware identifier, or indexed identifier. So we reuse the code from gate call. The code in oq3_parser is a bit mysterious. I added some comments to make it easier to locate next time, I hope. * Add test for measuring hardware qubit
- Loading branch information
Showing
7 changed files
with
154 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters