#ast #policy-language #aranya #fact #action

no-std aranya-policy-ast

The Aranya Policy Language AST

16 releases (breaking)

Uses new Rust 2024

new 0.13.0 Mar 18, 2026
0.12.0 Jan 23, 2026
0.10.0 Dec 11, 2025
0.9.0 Nov 5, 2025
0.1.0 Oct 16, 2024

#2 in #policy-language

Download history 239/week @ 2025-11-26 1494/week @ 2025-12-03 2492/week @ 2025-12-10 720/week @ 2025-12-17 25/week @ 2025-12-24 1025/week @ 2025-12-31 1809/week @ 2026-01-07 2494/week @ 2026-01-14 3802/week @ 2026-01-21 1502/week @ 2026-01-28 1473/week @ 2026-02-04 1571/week @ 2026-02-11 3538/week @ 2026-02-18 2417/week @ 2026-02-25 1084/week @ 2026-03-04 1361/week @ 2026-03-11

8,573 downloads per month
Used in 16 crates (5 directly)

AGPL-3.0-only

92KB
2K SLoC

aranya-policy-ast

The Abstract Syntax Tree (AST) for the Aranya Policy Language.

Overview

This crate provides the data structures that represent the parsed form of Aranya Policy Language source code. It defines the AST nodes for all language constructs including policies, facts, actions, effects, expressions, statements, and type definitions.

The AST is the intermediate representation used by the Aranya Policy Language compiler and other tools that need to analyze or transform policy code.

Usage

use aranya_policy_ast::Version;
use aranya_policy_lang::lang::parse_policy_str;
use aranya_policy_compiler::Compiler;

// Create a new policy AST
let policy = parse_policy_str("policy code", Version::V2)?;

// Compile AST into module
let module = Compiler::new(&policy).compile()?;

Features

  • std - Enable standard library support (default: disabled)
  • proptest - Enable property testing support for AST nodes (default: disabled)

Serialization

All AST types support serialization through:

  • Serde - For JSON/YAML serialization
  • rkyv - For efficient binary serialization with zero-copy deserialization

No-std Support

This crate supports no_std environments by default, using alloc for dynamic allocations. Enable the std feature for full standard library support.

Dependencies

~2–3.5MB
~74K SLoC