Reference OpenQASM AST in Python
Project description
OpenNode: a reference OpenQASM 3.0 AST in Python
This directory contains a reference AST implementation for OpenQASM 3.0 in Python. It consists of:
- ast.py: The AST nodes.
- parser/antlr: A parser based on Antlr grammar and reference parser also found in this repo. It walks the ANTLR parse tree to generate the AST tree.
- ast_visitor: A base AST visitor and an example showing how to implement compiler passes using the visitor.
- tests: A set of unit tests.
Developer setup
- Setup the Antlr tools following the README under grammar. Then from source/grammar directory, run:
antlr4 -o ../openqasm/parser/antlr -Dlanguage=Python3 -visitor qasm3.g4
- Change to the current directory and install additional requirements with
pip install -r requirements.txt -r requirements-dev.txt
. - Format python code:
black .
. - Check style:
bylint .
. - Run tests:
pytest
.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
openqasm3-0.0.0.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for openqasm3-0.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d992b90b30e6a89cfc768f83d50e9a2cb7a95b12db1c01e0175b8262b1557772 |
|
MD5 | c5993e2e2ba89a7f8b68ac4c7f172408 |
|
BLAKE2b-256 | 04028695b18a024d4a6c0491a15b19010c8418e22d6b66869302595b4e009fe3 |