Skip to main content

A Python Parser for the SISQ Quantum Instruction Set

Project description

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.0
  • numpy
  • bidict

🔗 相关资源

🙏 致谢

  • 感谢 ANTLR 提供强大的语法解析工具
  • 感谢所有贡献者的努力和支持

Built with ❤️ for the quantum computing community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sisq-0.2.1-py3-none-any.whl (142.3 kB view details)

Uploaded Python 3

File details

Details for the file sisq-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sisq-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 142.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.21

File hashes

Hashes for sisq-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1b546dc41b817c1217940df20b89ea530582b66249808087446bd406b6af77a2
MD5 5e0dea753e156166ab55d0cc918ffc5e
BLAKE2b-256 ae0f79bf25c612ba55a0aed8604e7c4331d251a145af6314644f254b2f156a8d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page