SISQ Parser
SISQ (Simplified Instruction Set for Quantum computing) 解析器的 Python 实现。SISQ 是一种专为量子计算设计的中间表示语言,支持量子门操作、脉冲控制、时序管理等功能。
🚀 特性
- 完整的量子指令集支持:支持量子门、脉冲、时序、控制流等指令
- 模块化设计:支持 cm(控制模块)、fm(浮点模块)、gm(量子门模块)、im(整数模块)、pm(脉冲模块)、tm(时序模块)
- 类型检查:完善的变量类型检查和错误报告
- 布局管理:支持量子比特和端口的物理布局定义
- 可扩展性:基于 ANTLR 语法,易于扩展和修改
- 模拟器验证:与 QuaLeSim 模拟器无缝集成
- 灵活的输入输出:支持文件、标准输入、字符串等多种输入方式
📦 安装
从 PyPI 安装(推荐)
pip install sisq
从源码安装
git clone https://gitee.com/hpcl_quanta/sisq-parser.git
cd sisq-parser/python
pip install -e .
📖 快速开始
基本使用
from sisq import SisqParser
# 创建解析器实例
parser = SisqParser()
# 解析 SISQ 文件
prog = parser.parse("path/to/file.sisq")
# 检查解析错误
parser.print_all_errors()
从字符串解析
from sisq import SisqParser
parser = SisqParser()
sisq_code = """
using im, gm
.code:
def_func test(qubit q):
H q
end
.entry:
qubit q
test(q)
"""
prog = parser.parse(sisq_code, is_string_content=True)
打印抽象语法树
from sisq import SisqParser
parser = SisqParser()
prog = parser.parse("file.sisq", cst_print=True) # 打印 CST
📋 依赖
- Python 3.7+
antlr4-python3-runtime==4.13.0numpybidict
🔗 相关资源
- 项目仓库:Gitee Repository
- SISQ语法规范:SISQ
🙏 致谢
- 感谢 ANTLR 提供强大的语法解析工具
- 感谢所有贡献者的努力和支持
Metadata
Release files for sisq 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sisq-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Release files / sisq-0.2.1-py3-none-any.whl
| Download URL | sisq-0.2.1-py3-none-any.whl |
|---|---|
| Size | 142.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b546dc41b817c1217940df20b89ea530582b66249808087446bd406b6af77a2
|
|
BLAKE2b-256 checksum How to use checksums |
ae0f79bf25c612ba55a0aed8604e7c4331d251a145af6314644f254b2f156a8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.21
|
Security for sisq 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.