How phreda4/r3 works
Core Language Components
• R3 Virtual Machine (central component)
• Compiler/Parser System
• Memory Management System (64-bit cells with 8,16,32-bit access)
• Dynamic Library Interface
Development Environment
• Code Editor/Browser
• File System Interface
• SDL2 Integration Layer
• Platform-specific Components (Windows/Linux)
Main Layers (top to bottom)
a. User Interface Layer
• Editor/Browser Interface
• Code Visualization
• File Navigation System
b. Language Processing Layer
• Parser (r3parse.r3)
• Compiler Passes (r3pass1.r3 through r3pass4.r3)
• Code Generation (r3gencod.r3, r3gendat.r3)
c. Execution Layer
• Virtual Machine (r3vm.r3)
• Memory Manager
• Stack System (r3stack.r3)
d. Platform Integration Layer
• SDL2 Bindings
• Dynamic Library Loading
• OS-specific APIs (Win/Linux)
Connection Types
• Double lines: Data flow paths
Component Grouping
a. Core System:
• [Parser] → [Compiler] → [Code Generator] → [Virtual Machine]
• ↓
• [Memory Manager]
b. Development Tools:
• [Editor] ← [File Browser] → [Code Viewer]
• ↓
• [Compiler Interface]
c. Runtime System:
• [VM Runtime] → [Library Loader]
• ↓
• [Platform APIs] → [Graphics/Sound/Input]
Additional Elements
• Version information and platform support indicators
• File extension associations (.r3 files)
• Build/compilation flow
Implementation Details
• Use standardized UML notation where applicable
• Clear labels for all components
• Brief descriptions for key interfaces
• Error handling paths
Remember to include bidirectional relationships where appropriate, especially between the development environment and the core language components, as they interact during both development and runtime phases.