How varphi-online/wgraphc works
Frontend Layer
• HTML5 Canvas component for visualization
• TypeScript interfaces (from src/*.ts files)
• UI components (metaUI)
WebAssembly Bridge
• This in the middle as an intermediate layer
• Wasm.ts bridge file that handles WASM-JS communication
• Pkg/ directory components that facilitate the bridge
Rust Core (Backend)
• Split into two main modules:
a. Parser Module
b. Graph Module
Component Relationships
[HTML5 Canvas] ←→ [Graph Renderer (TS)]
• ↑ ↑
[MetaUI (TS)] ←→ [WASM Bridge]
• ↑
• [Rust Core (WASM)]
• / \
[Parser Module] [Graph Module]
Detailed Breakdown
Parser Module (Show as a subsystem):
• Lexer (lexer.rs)
• Tokenizer (tokenizer.rs)
• Evaluator (evaluator.rs)
• AST Structures (structs/)
Graph Module (Show as a subsystem):
• Grapher (grapher.rs)
• Variables (variables.rs)
Important Implementation Details to Note:
• Transformation pipeline from mathematical expression to visualization
• Complex number handling capabilities
• Grid system and viewport management
• Relationship between the canvas rendering and WASM calculations
Key Technical Considerations:
• UI rendering (TypeScript/JavaScript)
• Mathematical computations (Rust/WASM)
• Expression parsing and evaluation (Rust)
Performance Flow
• How expressions are parsed
• Where complex calculations occur
• Demonstrate the rendering pipeline
Remember to:
• Keep the main components clearly separated
• WebAssembly boundary explicitly
• Notes about key mathematical operations
• Where complex number handling occurs