Compiler for the Sutra programming language — tensor ops on frozen-LLM embedding vectors.
Project description
sutra-compiler
The compiler for the Sutra programming language — a purely functional language whose primitives are tensor operations on frozen-LLM embedding vectors.
Install
pip install sutra-compiler # validator + codegen only
pip install sutra-compiler[runtime] # adds torch so --emit / --run can execute the generated module
Requires Python 3.11+.
Use
After install, the sutrac command is on your $PATH.
# Validate a .su source file.
sutrac path/to/program.su
# Validate every .su file under a directory.
sutrac path/to/directory
# Compile to self-contained PyTorch Python and print to stdout.
sutrac --emit path/to/program.su
# Compile and execute in one step (requires the [runtime] extra installed).
sutrac --run path/to/program.su
# Step-by-step compilation review (source → AST → inline → simplify → emit).
sutrac --review path/to/program.su
# Cross-file class-name casing check.
sutrac --consistency path/to/directory
sutrac --help lists every flag.
What is Sutra
A .su source file looks like TypeScript — functions, classes, && / ||, string and numeric literals — but every value is a vector in a frozen LLM embedding space, and every operation is a tensor op on those vectors. The compiler emits self-contained Python that calls a small runtime; chains of bind / unbind / bundle / similarity reduce to chains of matrix multiplies that the simplifier folds into cached matrices at compile time.
The result is a program where there are no Python branches, no host-side if / while on data values, and no JIT — just one straight-line tensor expression.
For a full introduction, see sutralang.dev. For the language specification and design rationale, see the Sutra repository.
Status
Research-grade. Versions before 1.0 may break source compatibility. The grammar is stable; the codegen and the standard library still move.
Project details
Release history Release notifications | RSS feed
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 sutra_dev-0.2.0.tar.gz.
File metadata
- Download URL: sutra_dev-0.2.0.tar.gz
- Upload date:
- Size: 206.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13a9d0836633cdd45554e5334fe22cf8db735b97114f0ef7fea15e6cf98e0555
|
|
| MD5 |
9124c986ff1470d448b9a4d03f5a6081
|
|
| BLAKE2b-256 |
9380300bbc9e76f1522ece041100e8b68ead57698de23e302212f094e55746dc
|
Provenance
The following attestation bundles were made for sutra_dev-0.2.0.tar.gz:
Publisher:
publish-sutra-compiler.yml on EmmaLeonhart/Sutra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sutra_dev-0.2.0.tar.gz -
Subject digest:
13a9d0836633cdd45554e5334fe22cf8db735b97114f0ef7fea15e6cf98e0555 - Sigstore transparency entry: 1478919965
- Sigstore integration time:
-
Permalink:
EmmaLeonhart/Sutra@0979b4bf75f8369b229dcd255e3d786cbb41f182 -
Branch / Tag:
refs/tags/sutra-dev-v0.2.0 - Owner: https://github.com/EmmaLeonhart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sutra-compiler.yml@0979b4bf75f8369b229dcd255e3d786cbb41f182 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sutra_dev-0.2.0-py3-none-any.whl.
File metadata
- Download URL: sutra_dev-0.2.0-py3-none-any.whl
- Upload date:
- Size: 182.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
601292229230585d7ed144dd20e66255a32d7763f267810c945141b11bfcce18
|
|
| MD5 |
d6b1e03396cea67637f3f7c28d6baaf5
|
|
| BLAKE2b-256 |
78e6c5c5ddede25ad8dabf5b7ae86a9c1d526cb70984e8355a2c45cce2ca6843
|
Provenance
The following attestation bundles were made for sutra_dev-0.2.0-py3-none-any.whl:
Publisher:
publish-sutra-compiler.yml on EmmaLeonhart/Sutra
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sutra_dev-0.2.0-py3-none-any.whl -
Subject digest:
601292229230585d7ed144dd20e66255a32d7763f267810c945141b11bfcce18 - Sigstore transparency entry: 1478920093
- Sigstore integration time:
-
Permalink:
EmmaLeonhart/Sutra@0979b4bf75f8369b229dcd255e3d786cbb41f182 -
Branch / Tag:
refs/tags/sutra-dev-v0.2.0 - Owner: https://github.com/EmmaLeonhart
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-sutra-compiler.yml@0979b4bf75f8369b229dcd255e3d786cbb41f182 -
Trigger Event:
push
-
Statement type: