Crate jetcrab

Source
Expand description

§JetCrab JavaScript Engine

A high-performance JavaScript engine written in Rust, featuring a complete compilation pipeline from source code to bytecode execution.

§Overview

JetCrab provides a complete JavaScript runtime environment with:

  • Lexical Analysis: Tokenization of JavaScript source code
  • Parsing: AST generation and syntax validation
  • Semantic Analysis: Type checking and validation
  • Bytecode Generation: Compilation to VM instructions
  • Virtual Machine: High-performance bytecode execution
  • Module System: ES6 module support
  • Debugging Tools: Profiling and inspection capabilities

§Architecture

The engine follows a traditional compiler architecture:

Source Code → Lexer → Parser → AST → Semantic Analysis → Bytecode → VM Execution

§Usage

use jetcrab::Engine;

let mut engine = Engine::new();
let result = engine.evaluate("2 + 2 * 3")?;
println!("Result: {:?}", result);

§Features

  • ECMAScript 2020+ Support: Modern JavaScript features
  • High Performance: Optimized bytecode execution
  • Memory Safe: Built with Rust’s memory safety guarantees
  • Extensible: Plugin system for custom functionality
  • Cross Platform: Runs on Windows, macOS, and Linux

Re-exports§

pub use api::compiler::Compiler;
pub use api::engine::Engine;
pub use api::interpreter::Interpreter;
pub use api::config::EngineConfig;
pub use api::config::MemoryConfig;
pub use api::config::ModuleSystem;
pub use api::config::OptimizationLevel;
pub use api::config::SecurityLevel;
pub use api::debug::Breakpoint;
pub use api::debug::DebugInfo;
pub use api::debug::Debugger;
pub use api::debug::Inspector;
pub use api::debug::Profiler;
pub use api::debug::ProfilingMetrics;
pub use api::events::CallbackRegistry;
pub use api::events::EventChain;
pub use api::events::EventData;
pub use api::events::EventEmitter;
pub use api::events::EventManager;
pub use api::modules::ModuleInfo;
pub use api::modules::ModuleLoader;
pub use api::modules::ModuleProvider;
pub use api::modules::ModuleRegistry;
pub use api::error::ApiError;

Modules§

api
JetCrab API Module
ast
Abstract Syntax Tree (AST) Module
bytecode
Bytecode Generation Module
lexer
JavaScript Lexer Module
memory
Memory Management Module
parser
JavaScript Parser Module
runtime
Runtime Environment Module
semantic
Semantic Analysis Module
test_utils
Test Utilities Module
vm