zsuite
A toolkit for building programming languages in Python: syntax, checks, execution and editor support.
Programming languages, DSLs and data formats, from a grammar to a fast implementation with an editor. Each stage is its own package, usable alone; together they cover the whole way.
| Package | Stage | What it does | PyPI |
|---|---|---|---|
| zgram | Syntax | PEG grammars compiled to native parsers with LLVM: parse trees, ASTs, error messages, error recovery | zgram-py |
| zrules | Static semantics | Rules over zgram's trees: scopes and names, context rules, types (generics, unions, subtyping), control flow, diagnostics | zrules-py |
| zrun | Execution | Semantics written as Python functions, compiled to native code by partial evaluation; executables of a program | zrun-py |
| zlsp | Editors | A Language Server for any language defined with zgram and checked with zrules: diagnostics, navigation, completion, hover | zlsp-py |
Installation
pip install zsuite-py # the four packages, at versions that work together
pip install "zsuite-py[exe]" # and what building executables needs
The import names are zgram, zrules, zrun and zlsp (each can also be installed alone as <name>-py). Wheels cover CPython 3.10+ on x86_64 Linux and Windows.
Quick start
zsuite new calc # a language project: grammar, rules, semantics, language server, tests
cd calc
python calc.py run fib.calc # run a program, compiled to native code
python calc.py check fib.calc # its errors and warnings
python calc.py lsp # a language server for your editor
python -m pytest test_calc.py # its tests
The project is the tutorial's language under your name: change the grammar in syntax.py, the rules in checks.py, what each construct does in semantics.py, and the editor's view in server.py.
How they fit
source ──zgram──▶ parse tree ──zrules──▶ checked tree + symbols + types ──zrun──▶ running program
│
└──zlsp──▶ editor (diagnostics, go to definition, hover, ...)
- zgram turns text into a tree: a grammar in, a parser out (
zgram.compile(grammar)), its nodes labelled with what the grammar names them. - zrules checks the tree: rules written as selectors over node kinds (
"break_stmt"inside a loop, each name defined once in its scope, the types of expressions), reported as diagnostics with source positions. - zrun runs it: a semantic per node kind, plain Python taking the node and the runtime; zrun compiles the semantics for the program's tree to native code, so the language runs at a fraction of a hand-written interpreter's speed.
- zlsp serves it to editors: the grammar and the rules are all it needs.
Versions
Each package is released on its own; these are the current ones, which work together:
| zgram | zrules | zrun | zlsp |
|---|---|---|---|
| 0.6.0 | 0.2.0 | 0.7.4 | 0.1.3 |
Documentation
- Tutorial: building a language through all four stages, from grammar to editor and executable.
- Best practices: grammars that recover well, rules, semantics that compile fast, testing, shipping.
- Design: how the suite fits together, its decisions and its roadmap.
- Each package's README is its reference.
Project Structure
src/zsuite/ # the zsuite package: versions(), `zsuite new`
examples/tiny/ # the tutorial's language: one file per stage, and its tests
# (also `zsuite new`'s template)
docs/ # the tutorial, best practices, the design
tests/ # the package's tests
License
MIT
Metadata
Release files for zsuite-py 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| zsuite_py-0.4.3.tar.gz | 29.6 kB | Without provenance | Details for zsuite_py-0.4.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| zsuite_py-0.4.3-py3-none-any.whl | Python 3 | none | any | Details for zsuite_py-0.4.3-py3-none-any.whl |
Total release size: 42.7 kB
Release files / zsuite_py-0.4.3.tar.gz
| Download URL | zsuite_py-0.4.3.tar.gz |
|---|---|
| Size | 29.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e204f1a536fd83349f2f55a44bbc2e3416cffbcc05d7d234ed6eb47c81626c89
|
|
BLAKE2b-256 checksum How to use checksums |
51c33a59d2a785c199d6b47eced2ac3f63e44f70aa002c4c057bff7dc91660fe
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / zsuite_py-0.4.3-py3-none-any.whl
| Download URL | zsuite_py-0.4.3-py3-none-any.whl |
|---|---|
| Size | 13.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
53348116d707f4ae799f6d4cba6af26f9a3141ef6483b48a53e9141617ba7e10
|
|
BLAKE2b-256 checksum How to use checksums |
ab1567120df9d7c847eb5b774475d3d90e3a2e104d9e31a96d3a0a656796b81c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for zsuite-py 0.4.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.