diff --git a/README.md b/README.md index 0256444..e5fd030 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,7 @@ circuit = parser.parse_file("my_circuit.qasm") | [x](https://openqasm.com/language/standard_library.html#x) | X | | [y](https://openqasm.com/language/standard_library.html#y) | Y | | [z](https://openqasm.com/language/standard_library.html#z) | Z | +| [id](https://openqasm.com/language/standard_library.html#id) | I | | [rx](https://openqasm.com/language/standard_library.html#rx) | RX | | [ry](https://openqasm.com/language/standard_library.html#ry) | RY | | [rz](https://openqasm.com/language/standard_library.html#rz) | RZ | diff --git a/graphix_qasm_parser/parser.py b/graphix_qasm_parser/parser.py index 8abe05f..9f6738b 100644 --- a/graphix_qasm_parser/parser.py +++ b/graphix_qasm_parser/parser.py @@ -13,7 +13,7 @@ ParserRuleContext, ) from graphix import Circuit -from graphix.instruction import CCX, CNOT, RX, RY, RZ, RZZ, SWAP, H, S, X, Y, Z +from graphix.instruction import CCX, CNOT, RX, RY, RZ, RZZ, SWAP, H, I, S, X, Y, Z from openqasm_parser import qasm3Lexer, qasm3Parser, qasm3ParserVisitor # override introduced in Python 3.12 @@ -317,6 +317,9 @@ def visitGateCallStatement(self, ctx: qasm3Parser.GateCallStatementContext) -> N elif gate == "z": # https://openqasm.com/language/standard_library.html#z instruction = Z(target=operands[0]) + elif gate == "id": + # https://openqasm.com/language/standard_library.html#id + instruction = I(target=operands[0]) elif gate == "rx": # https://openqasm.com/language/standard_library.html#rx instruction = RX(target=operands[0], angle=exprs[0])