A high-level Python package to parse Zig code.
Project description
Zyntex - High-level Zig parser for Python
Zyntex focuses on high-level elements of Zig code (e.g. functions, variables, tests).
Function bodies and other low-level constructs are currently returned as raw strings.
Support for deeper elements is planned. Internally, it uses bindings to Zig's std AST parser,
making it both fast and memory-efficient.
Important: currently bindings are only available for windows-x86_64, macos-x86_64, and linux-x86_64.
On other architectures the library will not work. Support for additional targets is planned,
but low priority.
Features
- Parse Zig source from strings or files.
- High-performance, low-memory parsing powered by Zig’s
stdparser. - Easy-to-use, Pythonic API designed for inspection and transformation of Zig code.
- Planned: code generation (printers) to emit Zig from Python objects.
Installation
pip install zyntex
Minimal example
from typing import cast
from zyntex.syntax import VariableDeclaration
from zyntex import SourceCode
src = SourceCode("const result: usize = 15 + 15;")
variable = cast(VariableDeclaration, src.content[0])
print(variable.name) # result
print(variable.const) # True
License
See the LICENSE file in the repository.
For questions or contributions, open an issue or PR on the project repository.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zyntex-0.0.2.tar.gz.
File metadata
- Download URL: zyntex-0.0.2.tar.gz
- Upload date:
- Size: 21.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
074873476457cfc368b4cb0b106417e8b28b4dd1df11a0afe79af49ca27634e7
|
|
| MD5 |
db77ba72a1ef84add86ed62741ad764f
|
|
| BLAKE2b-256 |
fd9a624016678042e85dc189dfa2b5ac3a71e18a5b30858e85f110675e442187
|
File details
Details for the file zyntex-0.0.2-py3-none-any.whl.
File metadata
- Download URL: zyntex-0.0.2-py3-none-any.whl
- Upload date:
- Size: 1.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.23
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c46133317469de3810a9305c5634e11840a9a742c94603e42a8f8fce94f1d63
|
|
| MD5 |
a262388f98f26fca13e0dcf1d6c69490
|
|
| BLAKE2b-256 |
84ef234f4089f4ba40126fc32937928c5830391ea8a8bad880e1168373af6a19
|