xXenvy/zyntex
A high-level Python package to parse Zig code.
Docs: https://zyntex.readthedocs.io/en/latest
Zyntex is a Python package that allows you to parse Zig code and perform operations on
high-level language elements (functions, variables).
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.
Be aware that the project is at a very early stage of development and is actively being developed.
std
parser.pip install zyntex
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
For questions or contributions, open an issue or PR on the project repository.