Module arena

Module arena 

Source
Expand description

Arena allocation for stable AST references.

This module provides bump allocation for AST nodes, ensuring references remain valid throughout parsing and semantic analysis. The arena pattern eliminates reference counting overhead and enables zero-copy parsing.

§Example

use logicaffeine_base::Arena;

let arena: Arena<String> = Arena::new();
let s1 = arena.alloc("hello".to_string());
let s2 = arena.alloc("world".to_string());

// Both references remain valid as long as arena is alive
assert_eq!(s1, "hello");
assert_eq!(s2, "world");

§REPL Reuse

For interactive use, call Arena::reset between evaluations to reclaim memory while keeping allocated capacity.

Structs§

Arena
A bump allocator for stable, arena-allocated references.