Depyler Core - Transpilation Engine
Core transpilation engine for converting Python code to Rust and other targets.
Overview
This crate provides the fundamental transpilation pipeline that converts Python source code into target languages (Rust, Ruchy) while preserving semantics and ensuring memory safety.
Example
use DepylerPipeline;
let pipeline = new;
let python = r#"
def factorial(n: int) -> int:
if n <= 1:
return 1
return n * factorial(n - 1)
"#;
match pipeline.transpile
Architecture
The transpilation pipeline consists of several stages:
- Parsing ([
ast_bridge]) - Convert Python source to AST - HIR ([
hir]) - Transform AST to High-level Intermediate Representation - Type Analysis ([
generic_inference], [const_generic_inference]) - Infer types and generics - Ownership Analysis ([
borrowing], [lifetime_analysis]) - Determine ownership patterns - Optimization ([
optimization], [string_optimization]) - Apply optimizations - Code Generation ([
codegen], [rust_gen]) - Generate target code
Key Types
- [
DepylerPipeline] - Main entry point for transpilation - [
TranspileOptions] - Configuration options - [
Hir] - High-level intermediate representation - [
TranspilationBackend] - Backend trait for target languages