How ashinn/chibi-scheme works
Main Components
a. Core Runtime Components:
• VM Engine (vm.c)
• Memory Management (gc.c, gc_heap.c)
• Evaluator (eval.c)
• S-Expression Handler (sexp.c)
b. Language Implementation Layers:
• R7RS Small Base Implementation
• Standard Library Modules (lib/scheme/*)
• SRFI Implementations (lib/srfi/*)
• Extension Modules (lib/chibi/*)
c. Foreign Function Interface:
• FFI System
• Native Bindings
• Stub Generators
d. Build & Integration Systems:
• Build System (CMake support)
• Package Management (Snow)
• Testing Framework
Component Relationships
[Core Runtime Layer]
• [VM Engine] ←→ [Memory Management]
• ↑
• [Evaluator] ←→ [S-Expression Handler]
• ↑
[Language Implementation Layer]
• ↑
• [R7RS Base] ←→ [Standard Library]
• ↑
• [SRFI Modules] ←→ [Extension Modules]
• ↑
[Integration Layer]
• ↑
• [FFI System] ←→ [Native Bindings]
• ↑
• [Build System] ←→ [Package Manager]
Important Design Elements to Highlight
a. Isolation Features:
• VM-based threads
• Isolated heaps per VM
• Multi-threading support
b. Language Features:
• Full numeric tower
• Unicode support
• Hygienic macros
• Module system
c. Integration Points:
• C program embedding
• FFI system
• Platform-specific adaptations
Cross-cutting Concerns
• Memory Management
• Thread Safety
• Platform Compatibility
• Error Handling
Implementation Details
[VM Engine]
• Thread Management
• Instruction Set
• State Management
[Memory Management]
• Garbage Collection
• Heap Isolation
• Resource Tracking
[Language Features]
• Numeric Tower
• Unicode Support
• Macro System
• Module System
External Interfaces
• C API for embedding
• Command-line REPL
• Package management interface
• Build system integration
Integration interfaces
This design captures both the minimal nature of the implementation while showing its extensibility and robustness for use as an embedded language system.