jetcrab/lib.rs
1//! # JetCrab JavaScript Engine
2//!
3//! A high-performance JavaScript engine written in Rust, featuring a complete
4//! compilation pipeline from source code to bytecode execution.
5//!
6//! ## Overview
7//!
8//! JetCrab provides a complete JavaScript runtime environment with:
9//!
10//! - **Lexical Analysis**: Tokenization of JavaScript source code
11//! - **Parsing**: AST generation and syntax validation
12//! - **Semantic Analysis**: Type checking and validation
13//! - **Bytecode Generation**: Compilation to VM instructions
14//! - **Virtual Machine**: High-performance bytecode execution
15//! - **Module System**: ES6 module support
16//! - **Debugging Tools**: Profiling and inspection capabilities
17//!
18//! ## Architecture
19//!
20//! The engine follows a traditional compiler architecture:
21//!
22//! ```text
23//! Source Code → Lexer → Parser → AST → Semantic Analysis → Bytecode → VM Execution
24//! ```
25//!
26//! ## Usage
27//!
28//! ```rust
29//! use jetcrab::Engine;
30//!
31//! let mut engine = Engine::new();
32//! let result = engine.evaluate("2 + 2 * 3")?;
33//! println!("Result: {:?}", result);
34//! ```
35//!
36//! ## Features
37//!
38//! - **ECMAScript 2020+ Support**: Modern JavaScript features
39//! - **High Performance**: Optimized bytecode execution
40//! - **Memory Safe**: Built with Rust's memory safety guarantees
41//! - **Extensible**: Plugin system for custom functionality
42//! - **Cross Platform**: Runs on Windows, macOS, and Linux
43
44pub mod api;
45pub mod ast;
46pub mod bytecode;
47pub mod lexer;
48pub mod memory;
49pub mod parser;
50pub mod runtime;
51pub mod semantic;
52pub mod test_utils;
53pub mod vm;
54
55// Core API exports
56pub use api::compiler::Compiler;
57pub use api::engine::Engine;
58pub use api::interpreter::Interpreter;
59
60// Configuration and customization
61pub use api::config::{EngineConfig, MemoryConfig, ModuleSystem, OptimizationLevel, SecurityLevel};
62
63// Debugging and profiling
64pub use api::debug::{Breakpoint, DebugInfo, Debugger, Inspector, Profiler, ProfilingMetrics};
65
66// Event system and callbacks
67pub use api::events::{CallbackRegistry, EventChain, EventData, EventEmitter, EventManager};
68
69// Module system
70pub use api::modules::{ModuleInfo, ModuleLoader, ModuleProvider, ModuleRegistry};
71
72// Error handling
73pub use api::error::ApiError;