Release Highlights
- Improved setup.cfg packaging
- Added todo.md at source/openqasm/src/openqasm/translator/tests/todo.md to keep track of required changes in translator
- Updated Makefiles for easy installation and building grammar
- Changes in ast.py - LiChen
- Notable Changes:
- Fixed NoDesignatorType parsing ub qasn_parser.py
- Added include statement type in ast.py
- Consistent use of Identifier and str. Refined QuantumGateDefinition, QuantumWhileLoop, Expression, Identifier, Qubit, FunctionCall, QuantumGate, QuantumMeasurementAssignment, BitType, ComplexType, CalibrationDefinition, SubroutineDefinition, BranchingStatement, BinaryExpression in ast.py
- Simplified version parsing and formatting
- Notable Changes:
- Updated test.qasm with basic tests
- Added support for Identifier and IndexIdentifier subscripts
Update notes
- source/openqasm/src/openqasm/translator/context.py -
- Added modify_symbol to modify given symbol to the context with the provided value
- Updated assign_value_symbol to accommodate float, bool and ClassicalType
- source/openqasm/src/openqasm/translator/translator.py -
- Updated type imports
- source/openqasm/src/openqasm/translator/test.py -
- Updated type testing. Added testing for return types
- Functions now use cast instead of coerce
- source/openqasm/src/openqasm/translator/identifiers.py -
- Added get_register
- source/openqasm/src/openqasm/translator/expressions.py -
- Updated import statements
- Updated _ComputeAssignmentExpressionNamespace _FUNCTIONS dict
- source/openqasm/src/openqasm/translator/exceptions.py -
- Removed ClassicalTypeOverflow
- source/openqasm/src/openqasm/translator/types.py -
- Fixed typing issue for AngleType, UnsignedIntegerType and BitArrayType
- Update get_typecast and get_typevar to get mapping and instance creation from AST to translator types
- Fixed get_typecast now checks for variable type before returning a value.
- source/openqasm/src/openqasm/build_ast.py -
- Added testing rountine for adder.qasm. Checks statement type translation, version detection, Listing of for loops
- Operation support
Type \ Operator | = | & | or | ^ | « | » | ~ | popcount | rotl | rotr | > | >= | < | <= | == | != | && | oror | ! | + | - | * | / | % | ** |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
BitArray | o | o | o | o | o | o | o | o | o | o | ? | ? | ? | ? | ? | ? | |||||||||
SignedInteger | o | o | o | o | o | o | o | o | o | o | o | o | o | ||||||||||||
UnsignedInteger | o | o | o | o | o | o | o | o | o | o | o | o | o | ||||||||||||
Float | o | o | o | o | o | o | o | o | o | o | o | o | o | ||||||||||||
Angle | o | o | o | o | o | o | o | o | o | o | o | o | o | ||||||||||||
bool | o | o | o | o | |||||||||||||||||||||
complex[x] | o | o | o | o | o | ? |
- Type cast support
From \ To | bit | BitArray | SignedInteger | UnsignedInteger | Float | Angle | bool | complex[x] |
---|---|---|---|---|---|---|---|---|
bit | o | o | o | o | o | |||
BitArray | o | o | o | ? | ? | |||
SignedInteger | o | o+ | o+ | |||||
UnsignedInteger | o | o+ | o+ | |||||
Float | ? | ? | o | o+ | ||||
Angle | ? | o | ||||||
bool | o | ? | o | |||||
complex[x] | ? | ? | ? | ? | o |
o+ means that the casts are allowed even between types that do not have the same sizes.
Angles (and integers and floats) cannot be measured
The following code
angle[20] c;
qubit q;
measure q -> c[0];
is ill-formed according to https://qiskit.github.io/openqasm/language/insts.html
- The statement
bit|bit[] = measure qubit|qreg;
measures the qubit(s) in the Z-basis and assigns the measurement outcome(s) to the target bit(s). - For backwards compatibility this is equivalent to
measure qubit|qubit[] -> bit|bit[];
which is also supported. - Measurement corresponds to a projection onto one of the eigenstates of , and qubit(s) are immediately available for further quantum computation.
Both arguments must be register-type, or both must be bit-type. - If both arguments are register-type and have the same size, the statement
b = measure a;
broadcasts tob[j] = measure a[j];
for each index j into register a.