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
8,573 downloads per month
Used in 16 crates
(5 directly)
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