openqasm / qe-compiler

An MLIR based compiler dynamic circuit compiler for real-time control systems supporting OpenQASM 3
Other
46 stars 15 forks source link

Add support for operation precedance in expression #270

Open taalexander opened 7 months ago

taalexander commented 7 months ago

263 adds support for binary/unary expressions on integers and floats to the compiler. However, currently these are evaluated with left-right infix ordering. This means that if parentheses aren't added expressions like a * b ** c will be evaluated as (a * b) ** c) which disobeys standard arithmetic operation precedence. The qe-qasm parser has a ASTOperatorPrecdeanceController that can be used to build the correct expressions.