An OPENQASM 2.0 parser for Python
pip install openqasm
from openqasm import Qasm
file_path = '/path/to/file.qasm'
# Parse the QASM file
qasm = Qasm(file_path)
# Get AST
ast = qasm.parse()
# Print the parsed QASM with precision=15
print(ast.qasm(15))
Apache 2.0