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 details)
Built Distribution
File details
Details for the file openqasm3-0.0.0.tar.gz
.
File metadata
- Download URL: openqasm3-0.0.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 780eecc3c6797dd0ad0a925b5826c780338af437709113a2afd5ede82323a452 |
|
MD5 | 17ff45b79c505720c5f265daa4c54f45 |
|
BLAKE2b-256 | b6bf2c607bc7afa9cef03adf891acd791e0f8707d853bd9170b8fff6fc9ad94b |
File details
Details for the file openqasm3-0.0.0-py3-none-any.whl
.
File metadata
- Download URL: openqasm3-0.0.0-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d992b90b30e6a89cfc768f83d50e9a2cb7a95b12db1c01e0175b8262b1557772 |
|
MD5 | c5993e2e2ba89a7f8b68ac4c7f172408 |
|
BLAKE2b-256 | 04028695b18a024d4a6c0491a15b19010c8418e22d6b66869302595b4e009fe3 |