jetcrab\bytecode/mod.rs
1//! # Bytecode Generation Module
2//!
3//! Converts Abstract Syntax Trees (AST) into executable bytecode instructions
4//! for the virtual machine, including optimization and scope management.
5//!
6//! ## Overview
7//!
8//! The bytecode module handles:
9//!
10//! - **Code Generation**: AST to bytecode conversion
11//! - **Optimization**: Instruction-level optimizations
12//! - **Scope Management**: Variable and function scope tracking
13//! - **Statement Compilation**: Control flow and declarations
14//! - **Expression Compilation**: Operations and function calls
15//! - **Literal Handling**: Constants and value compilation
16//!
17//! ## Architecture
18//!
19//! The bytecode generator follows a visitor pattern:
20//! - Traverses AST nodes
21//! - Generates appropriate instructions
22//! - Manages constant pool
23//! - Tracks scope information
24//!
25//! ## Usage
26//!
27//! ```rust
28//! use jetcrab::bytecode::BytecodeGenerator;
29//! use jetcrab::ast::Node;
30//!
31//! let mut generator = BytecodeGenerator::new();
32//! let bytecode = generator.generate(&ast);
33//! let constants = generator.get_constants();
34//! ```
35
36pub mod error;
37pub mod expressions;
38pub mod generator;
39pub mod literals;
40pub mod optimizer;
41pub mod scope;
42pub mod statements;
43
44pub use error::BytecodeError;
45pub use generator::BytecodeGenerator;