Metadata-Version: 2.2
Name: sisq
Version: 0.2.1
Summary: A Python Parser for the SISQ Quantum Instruction Set
Home-page: https://gitee.com/hpcl_quanta/quiet-parser.git
Author: Yuzhen Zheng, Zhengdong Tang, Xiang Fu
Author-email: gtaifu@gmail.com
Project-URL: Bug Tracker, https://gitee.com/hpcl_quanta/quiet-parser/issues
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.7
Description-Content-Type: text/markdown
Requires-Dist: antlr4-python3-runtime==4.13.0
Requires-Dist: numpy
Requires-Dist: bidict

# SISQ Parser

**SISQ (Simplified Instruction Set for Quantum computing)** 解析器的 Python 实现。SISQ 是一种专为量子计算设计的中间表示语言，支持量子门操作、脉冲控制、时序管理等功能。

## 🚀 特性

- **完整的量子指令集支持**：支持量子门、脉冲、时序、控制流等指令
- **模块化设计**：支持 cm(控制模块)、fm(浮点模块)、gm(量子门模块)、im(整数模块)、pm(脉冲模块)、tm(时序模块)
- **类型检查**：完善的变量类型检查和错误报告
- **布局管理**：支持量子比特和端口的物理布局定义
- **可扩展性**：基于 ANTLR 语法，易于扩展和修改
- **模拟器验证**：与 QuaLeSim 模拟器无缝集成
- **灵活的输入输出**：支持文件、标准输入、字符串等多种输入方式

## 📦 安装

### 从 PyPI 安装（推荐）

```bash
pip install sisq
```

### 从源码安装

```bash
git clone https://gitee.com/hpcl_quanta/sisq-parser.git
cd sisq-parser/python
pip install -e .
```

## 📖 快速开始

### 基本使用

```python
from sisq import SisqParser

# 创建解析器实例
parser = SisqParser()

# 解析 SISQ 文件
prog = parser.parse("path/to/file.sisq")

# 检查解析错误
parser.print_all_errors()
```

### 从字符串解析

```python
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)
```

### 打印抽象语法树

```python
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`

## 🔗 相关资源

- **项目仓库**：[Gitee Repository](https://gitee.com/hpcl_quanta/sisq-parser)
- **SISQ语法规范**：[SISQ](https://gitee.com/hpcl_quanta/sisq-parser/docs/SISQ规范文档.md)

## 🙏 致谢

- 感谢 [ANTLR](https://www.antlr.org/) 提供强大的语法解析工具
- 感谢所有贡献者的努力和支持

---

<div align="center">
  <sub>Built with ❤️ for the quantum computing community</sub>
</div>

