pa-compiler 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pa_compiler-0.1.0.dist-info/METADATA +144 -0
- pa_compiler-0.1.0.dist-info/RECORD +24 -0
- pa_compiler-0.1.0.dist-info/WHEEL +5 -0
- pa_compiler-0.1.0.dist-info/entry_points.txt +2 -0
- pa_compiler-0.1.0.dist-info/licenses/LICENSE +21 -0
- pa_compiler-0.1.0.dist-info/top_level.txt +1 -0
- pa_lang/__init__.py +2 -0
- pa_lang/build.py +574 -0
- pa_lang/cli.py +139 -0
- pa_lang/codegen.py +1442 -0
- pa_lang/diagnostics.py +196 -0
- pa_lang/doctor.py +525 -0
- pa_lang/infer.py +1090 -0
- pa_lang/lsp_server.py +547 -0
- pa_lang/modules.py +432 -0
- pa_lang/paw.py +194 -0
- pa_lang/runtime_bridge.c +548 -0
- pa_lang/runtime_core.c +158 -0
- pa_lang/skills/cpp-to-pa/SKILL.md +30 -0
- pa_lang/skills/pa-coder/SKILL.md +64 -0
- pa_lang/skills/py-to-pa/SKILL.md +70 -0
- pa_lang/skills_cmd.py +129 -0
- pa_lang/types.py +346 -0
- pa_lang/validator.py +533 -0
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pa-compiler
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Pa language: Python-syntax, C++-memory-layout, LLVM-compiled systems language with .paw bridges to the Python ecosystem
|
|
5
|
+
Author: cyyier
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://palang.dev
|
|
8
|
+
Project-URL: Repository, https://github.com/cyyier/pa
|
|
9
|
+
Project-URL: Issues, https://github.com/cyyier/pa/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/cyyier/pa/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: compiler,llvm,python,systems-programming,ffi,language
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: C
|
|
23
|
+
Classifier: Topic :: Software Development :: Compilers
|
|
24
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: llvmlite>=0.50
|
|
29
|
+
Requires-Dist: pygls>=2.1
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: pytest; extra == "dev"
|
|
32
|
+
Provides-Extra: web
|
|
33
|
+
Requires-Dist: fastapi; extra == "web"
|
|
34
|
+
Requires-Dist: httpx; extra == "web"
|
|
35
|
+
Requires-Dist: uvicorn; extra == "web"
|
|
36
|
+
Provides-Extra: release
|
|
37
|
+
Requires-Dist: build; extra == "release"
|
|
38
|
+
Requires-Dist: twine; extra == "release"
|
|
39
|
+
Dynamic: license-file
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<img src="https://raw.githubusercontent.com/cyyier/pa/main/site/Pa.png" alt="Pa logo" width="72" />
|
|
43
|
+
</p>
|
|
44
|
+
|
|
45
|
+
<h1 align="center">Pa</h1>
|
|
46
|
+
|
|
47
|
+
<p align="center">
|
|
48
|
+
Python-syntax, C++-memory-layout, LLVM-compiled systems language with typed <code>.paw</code> bridges to the Python ecosystem.<br/>
|
|
49
|
+
<a href="https://palang.dev">Website</a> ·
|
|
50
|
+
<a href="https://palang.dev/quickstart">Quickstart</a> ·
|
|
51
|
+
<a href="https://palang.dev/architecture">Architecture</a> ·
|
|
52
|
+
<a href="https://github.com/cyyier/pa/blob/main/CHANGELOG.md">Changelog</a>
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Installation & Minimal Example
|
|
58
|
+
|
|
59
|
+
Requires Linux x86-64, macOS, or Windows x64, CPython 3.11–3.13 (headers + shared Python library), and a C compiler (`gcc`, `clang`, or MSVC `cl`).
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pip install pa-compiler # installs `pac`
|
|
63
|
+
pac skill --install claude # optional: install AI skills (also: cursor, codex, copilot, antigravity)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Create `hello.pa`:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
def sum_squares(n) -> int:
|
|
70
|
+
total = 0
|
|
71
|
+
for i in range(n):
|
|
72
|
+
total += i * i
|
|
73
|
+
return total
|
|
74
|
+
|
|
75
|
+
def main() -> int:
|
|
76
|
+
print(sum_squares(100000))
|
|
77
|
+
return 0
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Compile and run:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
pac build hello.pa --mode prod -o hello && ./hello
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
For `.paw` Python bridges, `--relocatable` bundles, `pac doctor`, and `--shared` C-ABI builds, see the full guide at <https://palang.dev/quickstart>.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Repository Layout
|
|
91
|
+
|
|
92
|
+
```text
|
|
93
|
+
pa/
|
|
94
|
+
├── pa_lang/
|
|
95
|
+
│ ├── types.py, validator.py, infer.py # Front-end: subset checks, bidirectional inference, escape analysis
|
|
96
|
+
│ ├── paw.py, diagnostics.py # .paw header parser/linter & AI JSON repair tickets
|
|
97
|
+
│ ├── codegen.py, build.py # LLVM IR emission (llvmlite), -O2 object build, gcc link, @export
|
|
98
|
+
│ ├── runtime_core.c, runtime_bridge.c # RAII fault/print core & embedded CPython zero-copy .paw bridge
|
|
99
|
+
│ ├── cli.py, doctor.py, skills_cmd.py # `pac` CLI: check, build, doctor, bundle, skill
|
|
100
|
+
│ ├── lsp_server.py # Auto-reloading LSP server (inlay hints, hover memory audit cards)
|
|
101
|
+
│ └── skills/ # Bundled SKILL.md assets shipped inside the wheel
|
|
102
|
+
├── skills/ # Source AI skills (pa-coder, py-to-pa, cpp-to-pa)
|
|
103
|
+
├── vscode-pa/ # VS Code extension (TextMate grammar, LSP client, grammar tests)
|
|
104
|
+
├── examples/ # pipeline_demo, hashlib_pa (Python port), raytracer (C++ port)
|
|
105
|
+
├── site/ # palang.dev static site (index, quickstart, architecture)
|
|
106
|
+
└── tests/ # Pytest suites (front-end, codegen, hardening, LSP, doctor, skill)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Building from Source & Testing
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
git clone https://github.com/cyyier/pa.git && cd pa
|
|
115
|
+
uv venv --python 3.12 .venv # or any CPython 3.11–3.13 with Python.h + shared libpython
|
|
116
|
+
source .venv/bin/activate
|
|
117
|
+
pip install -e ".[dev]"
|
|
118
|
+
|
|
119
|
+
pac doctor # verify gcc, llvmlite, Python.h, shared libpython
|
|
120
|
+
pac check examples tests # run Pa front-end checks
|
|
121
|
+
pytest -q # run full compiler, runtime, LSP, doctor, and CLI test suite
|
|
122
|
+
(cd vscode-pa && npm test) # run VS Code TextMate grammar tests
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Status & Roadmap
|
|
128
|
+
|
|
129
|
+
**Current (`v0.1.0` alpha):**
|
|
130
|
+
- **Supported:** Linux x86-64, macOS (arm64 / x86-64), Windows x64, CPython 3.11–3.13, `gcc` / `clang` / MSVC `cl`, LLVM via `llvmlite`.
|
|
131
|
+
- **Included:** zero-annotation `.pa` compiler (`int`/`uint`/`float`/`bool`, explicit widths `int32`/`uint8`/`uint32`/`uint64`/`float32` + short aliases `i32`/`u8`/`u32`/`u64`/`f32`, `**`, zero-copy `str_view` slicing, `@struct`, stack/RAII `Vec`, flat CSR `Vec[Vec[T]]`, `String`, `libm`, multi-file `.pa` module imports via local dirs / `-I` / `PA_PATH` / pip packages), `.paw` zero-copy CPython bridge with two-way customs, `--shared` guarded C-ABI libraries, `pac doctor` / `pac bundle` (ELF / Mach-O / PE), `pac skill`, `pac lsp`, and VS Code extension.
|
|
132
|
+
|
|
133
|
+
**Planned:**
|
|
134
|
+
- Standalone ecosystem packages (`pa-libs`) for common data, geometry, and parsing libraries (powered by multi-file `.pa` module imports).
|
|
135
|
+
- *(Low priority)* Nested `Vec` fields inside `@struct` with recursive RAII destructors (Pa recommends flat SoA arrays or CSR `Vec[Vec[T]]`).
|
|
136
|
+
|
|
137
|
+
**Non-goals (won't do):**
|
|
138
|
+
- Static `libpython` linking for single-file self-contained binaries — standard Python distributions do not ship portable `libpython.a` (especially on Windows/macOS), and third-party Python C extensions (`.pyd`/`.so` such as NumPy) require dynamic `libpython`. Use `pac build --bundle --with-stdlib` for self-contained directory distribution.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## License
|
|
143
|
+
|
|
144
|
+
MIT — see [LICENSE](https://github.com/cyyier/pa/blob/main/LICENSE). Release process: [RELEASING.md](https://github.com/cyyier/pa/blob/main/RELEASING.md).
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
pa_compiler-0.1.0.dist-info/licenses/LICENSE,sha256=vpIs8rZQ_tcSc6rfkIHNf8DWmJ511g1lWuY6J7LXL8E,1063
|
|
2
|
+
pa_lang/__init__.py,sha256=AJjjo5bNskUOARqRwYWxZttmyAQGFuOKTlc8z3EdUXY,51
|
|
3
|
+
pa_lang/build.py,sha256=9_WrWpxga524oYhqMaZTEnMLf_3N0XLmepPzddswons,26018
|
|
4
|
+
pa_lang/cli.py,sha256=5aaSS_HMuwiwtRmLQsmtrsKTUAbE_QQ2xUTGvWUJTWo,6007
|
|
5
|
+
pa_lang/codegen.py,sha256=gWXZ6vuHfWYykDMK7KAuiDgGrDintmReX5Fng1tSfaI,66566
|
|
6
|
+
pa_lang/diagnostics.py,sha256=VYQAP7r5GRXDkz7m-QvYVnd3W8zbFeXoFNwW5zukoj8,11269
|
|
7
|
+
pa_lang/doctor.py,sha256=4hhA6oVinPOUcb-h5tKVvQhBwOVFXTSrVeCA0tFqUd8,23989
|
|
8
|
+
pa_lang/infer.py,sha256=910KVQUgRjc0e83rtRU27NzqCw0Gtg6l4-NYcSFD1zU,52955
|
|
9
|
+
pa_lang/lsp_server.py,sha256=-NQeJmBS5wzGW9OnbPftF_47zLpPwKbGxiz-wnmRR7c,24235
|
|
10
|
+
pa_lang/modules.py,sha256=isvqu_cxyG9vN6AzUWbBQplkEqpiYdKbduJk7-oxfqw,17395
|
|
11
|
+
pa_lang/paw.py,sha256=F2GjoUGvXxJq8R_LqCeM7VQ_I1L9Hva9Llpg76aY6c4,9150
|
|
12
|
+
pa_lang/runtime_bridge.c,sha256=wltEjl4mUJHpySNyOTYJiyv_h2c0lA8CiVdqmxGjEDU,24305
|
|
13
|
+
pa_lang/runtime_core.c,sha256=nKhcOGHtZ1Fv40_6_KyTTAqVb18Umv8YDR1gnyachMA,6034
|
|
14
|
+
pa_lang/skills_cmd.py,sha256=VNn1cwmAeG8aEzLFFx4DxFic4qWPk0uh6bIov2c9Ftc,4416
|
|
15
|
+
pa_lang/types.py,sha256=NW6k0khUap-v7L5HIx13ZK2oZpgO4G1qKMeBI9vGwoU,9365
|
|
16
|
+
pa_lang/validator.py,sha256=G623NLB6BDqvQZFx0x_9RXTS2Gw-U_Ke-HbO7fN4bvY,28494
|
|
17
|
+
pa_lang/skills/cpp-to-pa/SKILL.md,sha256=eF4g0nFviONUBexKimT_s81YT0zTZNWVqFkC70VT4gI,2540
|
|
18
|
+
pa_lang/skills/pa-coder/SKILL.md,sha256=KDESxw7me6Cram_HYNyA8HLKiRZp7aHKp9jsjF17KPc,12395
|
|
19
|
+
pa_lang/skills/py-to-pa/SKILL.md,sha256=rJNp_LGZ6R38hq7WWgcznBRg0qspKgbmyTesUmj16ns,9762
|
|
20
|
+
pa_compiler-0.1.0.dist-info/METADATA,sha256=CxjM8S4035AH32dO_X4aQCc5jh92lvSUr7ZhFsGnxB8,6532
|
|
21
|
+
pa_compiler-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
22
|
+
pa_compiler-0.1.0.dist-info/entry_points.txt,sha256=bDs0pR1ll347972KW0ez978KlPgrBua0IWRtC7oXDJM,41
|
|
23
|
+
pa_compiler-0.1.0.dist-info/top_level.txt,sha256=HklYsf1TJKMOmXZaBvKcj2sFNdw-8Z722E-7GH_btAw,8
|
|
24
|
+
pa_compiler-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 cyyier
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pa_lang
|
pa_lang/__init__.py
ADDED