1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//! Script Engine - A lightweight, extensible script execution engine.
//!
//! This module provides a complete script interpretation pipeline:
//! 1. **Parse**: Convert script text into structured instructions via `InstructionHandler::parse()`
//! 2. **Compile**: Analyze instructions and establish relationships (optional, via lifecycle hooks)
//! 3. **Execute**: Run compiled instructions in the virtual machine
//!
//! # Architecture
//!
//! The engine follows a three-stage pipeline:
//! - [`parser`]: Tokenizes and parses script text into instruction sequences
//! - [`compiler`]: Resolves labels, validates structure, and optimizes instructions
//! - [`vm`]: Executes compiled instructions with register-based state management
//!
//! # Key Design Principles
//!
//! - **Single Trait Interface**: All instructions implement only `InstructionHandler`
//! - **Progressive Complexity**: Optional lifecycle hooks with default implementations
//! - **Zero Runtime Overhead**: Compile-time analysis, runtime transparency
//! - **Separation of Concerns**: Most handlers are simple (Parse + Execute). Complex instructions use lifecycle hooks for global context analysis.
//! - **Extensibility**: Lifecycle hooks allow any instruction to perform compile-time analysis (e.g., resource validation).
//!
//! # Modules
//!
//! - [`instruction`]: Core trait (`InstructionHandler`) and registry
//! - [`parser`]: Script text parsing and tokenization
//! - [`compiler`]: Instruction compilation and optimization
//! - [`vm`]: Virtual machine for instruction execution
//!
//! For detailed usage examples and comprehensive documentation, see individual submodule documentation.
// Re-export main types for convenience
pub use CompiledScript;
pub use ;
pub use ;
pub use ;
pub use ProcessContext;