Documentation

ASTx

ASTx

ASTx is the language-agnostic abstract syntax tree model shared by the ArxLang ecosystem. It lets frontends and compiler tools exchange typed Python objects without sharing a source grammar.

Status: functional and evolving. ASTx can model constructs that IRx or a particular source language does not yet lower.

Current capabilities

Architecture boundary

ASTx does not:

IRx consumes ASTx nodes and owns analysis, LLVM lowering, and the native Arrow C++ runtime. Source frontends such as Arx construct ASTx nodes.

Small example

import astx

body = astx.Block()
body.append(astx.FunctionReturn(astx.LiteralInt32(0)))

main = astx.FunctionDef(
    prototype=astx.FunctionPrototype(
        name="main",
        args=astx.Arguments(),
        return_type=astx.Int32(),
    ),
    body=body,
)

print(main.to_yaml())

License

ASTx is licensed under Apache-2.0 as part of the ArxLang monorepo.

Search documentation

Type to search.