ASTx
ASTx is a language-agnostic Python model for abstract syntax trees. It provides typed nodes and common metadata that parsers, analyzers, transpilers, and compiler backends can share without adopting a particular source grammar.
Status: functional and actively evolving. ASTx models more constructs than any one backend necessarily supports.
Scope
ASTx currently models:
- source locations, identifiers, expressions, statements, and blocks
- scalar, string, temporal, collection, generic, and union types
- functions, defaults, modules, packages, and imports
- conditionals, loops, generators, comprehensions, and context managers
- classes, structs, inheritance, member access, and modifiers
- templates, FFI pointers/opaque handles, and semantic helper metadata
- lists, buffer views, tensors, DataFrames, and Series
- YAML, JSON, Mermaid, PNG, and optional console visualization paths
ASTx does not lex or parse source and does not generate LLVM by itself. IRx is the Arx ecosystem backend that analyzes and lowers the supported ASTx subset.
Install
pip install astx
For ASCII visualization through mermaid-ascii:
pip install 'astx[console]'
Example
import astx
args = astx.Arguments(
astx.Argument(name="x", type_=astx.Int32()),
astx.Argument(name="y", type_=astx.Int32()),
)
body = astx.Block()
body.append(
astx.FunctionReturn(
astx.BinaryOp(
op_code="+",
lhs=astx.Variable("x"),
rhs=astx.Variable("y"),
)
)
)
add = astx.FunctionDef(
prototype=astx.FunctionPrototype(
name="add",
args=args,
return_type=astx.Int32(),
),
body=body,
)
print(add.to_yaml())
Relationship to Arrow
ASTx defines the compiler-facing node and type vocabulary for arrays, buffer views, Tensors, DataFrames, and Series. It deliberately does not depend on Apache Arrow or own native storage. IRx maps those nodes to its Arrow C++ runtime.
Documentation: https://arxlang.org/astx/
License: Apache-2.0.
Metadata
Release files for astx 1.24.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| astx-1.24.1.tar.gz | 47.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| astx-1.24.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 120.2 kB
Release files / astx-1.24.1.tar.gz
| Download URL | astx-1.24.1.tar.gz |
|---|---|
| Size | 47.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d81ee0aaca6c61438963ce00d5f86872a207cddf19ad50ce0d1d4c3667f005ee
|
|
BLAKE2b-256 checksum How to use checksums |
e116f573fa60d2d0b95614a27a623ad663929994ab3f089b1d1cbfd9facd0fce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1020-azure
|
Release files / astx-1.24.1-py3-none-any.whl
| Download URL | astx-1.24.1-py3-none-any.whl |
|---|---|
| Size | 72.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f48f68159ec0bafe5863295a6936466aa23f1ee150f7297b273a0563075f9dfd
|
|
BLAKE2b-256 checksum How to use checksums |
4b45b897be1a1a18f160be5470091713f00710a472d7d5e89d03ac62de1ed9cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.10.20 Linux/6.17.0-1020-azure
|