Skip to main content

Crate draxl

Crate draxl 

Source
Expand description

Public facade for Draxl, an agent-native source language with explicit syntax identity.

Draxl makes syntax identity explicit with stable node ids, ranks, anchors, and semantic patch operators so tools can edit the program tree directly instead of patching text spans.

This crate is the intended Rust integration surface for the workspace. It keeps the common workflows small and explicit while still re-exporting the lower-level crates for callers that need finer control.

let source = "@m1 mod demo { @f1[a] fn run() { @s1[a] @e1 work(); } }";
let file = draxl::parse_and_validate(source)?;
let formatted = draxl::format_source(source)?;
let lowered = draxl::lower_rust_source(source)?;
assert_eq!(file.items.len(), 1);
assert!(formatted.contains("@f1[a] fn run()"));
assert!(lowered.contains("fn run()"));

Re-exports§

pub use draxl_ast as ast;
pub use draxl_lower_rust as lower_rust;
pub use draxl_parser as parser;
pub use draxl_patch as patch;
pub use draxl_printer as printer;
pub use draxl_validate as validate;

Enums§

Error
Top-level error for parse-and-validate workflows.

Functions§

apply_patch
Applies a single structured patch operation.
apply_patches
Applies multiple structured patch operations in order.
dump_json_file
Emits deterministic JSON for a parsed Draxl file.
dump_json_source
Parses, validates, and emits deterministic JSON for a Draxl source string.
format_file
Canonically formats a parsed Draxl file.
format_source
Parses, validates, and canonically formats a Draxl source string.
lower_rust_file
Lowers a validated Draxl file to ordinary Rust source.
lower_rust_source
Parses, validates, and lowers Draxl source to ordinary Rust.
parse_and_validate
Parses and validates a Draxl source string in one step.
parse_file
Parses a Draxl source string into the typed AST.
validate_file
Validates a parsed Draxl file.

Type Aliases§

Result
Convenience result type for draxl workflows.