UI Implementation Roadmap

Advanced Compiler-Compiler Platform

UI Implementation Roadmap

Overview

This roadmap provides a detailed implementation strategy for bringing the UI capabilities from old_code into the current Minotaur project, with a focus on architectural integration and phased delivery.

Architecture Decision

┌─────────────────────────────────────────────────────────────┐
│                    Browser / Electron                       │
├─────────────────────────────────────────────────────────────┤
│                React/TypeScript Frontend                    │
│  ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐│
│  │   Editor    │ │Visualization│ │     Debugging         ││
│  │   Panel     │ │   Panel     │ │     Panel             ││
│  └─────────────┘ └─────────────┘ └─────────────────────────┘│
├─────────────────────────────────────────────────────────────┤
│                   REST API / SignalR                       │
├─────────────────────────────────────────────────────────────┤
│                    C# ASP.NET Core                         │
│  ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐│
│  │  Minotaur   │ │   Parser    │ │    Railroad            ││
│  │    Core     │ │  Services   │ │   Generator            ││
│  └─────────────┘ └─────────────┘ └─────────────────────────┘│
└─────────────────────────────────────────────────────────────┘

Phase 1: Foundation Setup (4 weeks)

Week 1: Project Structure & Build System

Goal: Establish web UI project structure integrated with C# backend

Tasks:

  1. Create Web UI Project
    src/
    ├── Minotaur.WebUI/           # New ASP.NET Core project
    │   ├── Controllers/
    │   ├── Hubs/                 # SignalR hubs
    │   ├── wwwroot/
    │   └── ClientApp/            # React application
    │       ├── src/
    │       │   ├── components/
    │       │   ├── services/
    │       │   └── types/
    │       ├── package.json
    │       └── vite.config.ts
    
  2. Setup Build Integration
    • Configure Vite for React/TypeScript
    • Setup ASP.NET Core to serve React app
    • Configure development proxy
    • Setup hot module replacement
  3. Basic Dependency Installation
    {
      "dependencies": {
        "react": "^18.2.0",
        "@types/react": "^18.2.0",
        "typescript": "^5.0.0",
        "vite": "^4.4.0",
        "@vitejs/plugin-react": "^4.0.0"
      }
    }
    

Deliverables:

Week 2: Core API Design & Communication Layer

Goal: Establish communication between React frontend and C# backend

Tasks:

  1. Design REST API Endpoints
    // Controllers/GrammarController.cs
    [ApiController]
    [Route("api/[controller]")]
    public class GrammarController : ControllerBase
    {
        [HttpPost("parse")]
        public async Task<ParseResult> ParseGrammar([FromBody] ParseRequest request)
           
        [HttpPost("validate")]
        public async Task<ValidationResult> ValidateGrammar([FromBody] string grammarCode)
           
        [HttpGet("samples")]
        public async Task<List<GrammarSample>> GetSamples()
    }
    
  2. Setup SignalR for Real-time Updates
    // Hubs/ParsingHub.cs
    public class ParsingHub : Hub
    {
        public async Task StartParsing(string grammarCode, string sourceCode)
        public async Task StopParsing()
    }
    
  3. Create TypeScript API Client
    // services/api.ts
    export class MinotaurApiClient {
      async parseGrammar(request: ParseRequest): Promise<ParseResult>
      async validateGrammar(grammarCode: string): Promise<ValidationResult>
      async getSamples(): Promise<GrammarSample[]>
    }
    

Deliverables:

Week 3: Main Application Shell

Goal: Create the main application structure and navigation

Tasks:

  1. Port App.tsx Structure
    // ClientApp/src/components/App.tsx
    interface AppState {
      grammarCode: string;
      sourceCode: string;
      parseTree: any;
      debugState: any;
      activeTab: string;
    }
    
  2. Implement Navigation System
    • Tab-based navigation
    • Route management
    • State persistence
  3. Basic Layout and Styling
    • Port CSS from old_code/src/App.css
    • Responsive design
    • Theme foundation

Deliverables:

Week 4: Core Editor Integration

Goal: Basic text editing functionality with backend integration

Tasks:

  1. Implement CodeEditor Component
    // components/CodeEditor.tsx
    interface CodeEditorProps {
      value: string;
      onChange: (value: string) => void;
      language: 'grammar' | 'source';
      readOnly?: boolean;
    }
    
  2. Choose and Integrate Code Editor
    • Monaco Editor (VS Code editor)
    • Basic syntax highlighting
    • Error highlighting integration
  3. Basic EditorPanel Implementation
    • Dual-pane editor layout
    • Save/load functionality
    • Parse button integration

Deliverables:

Phase 2: Core Visualization (6 weeks)

Week 5-6: Railroad Diagram Foundation

Goal: Implement basic railroad diagram generation and viewing

Tasks:

  1. Port RailroadIntegrationBridge
    // Services/RailroadService.cs
    public class RailroadService
    {
        public async Task<RailroadDiagram> GenerateDiagram(string grammarCode, RailroadOptions options)
        public async Task<ExportResult> ExportDiagram(RailroadDiagram diagram, ExportFormat format)
    }
    
  2. Create Basic RailroadDiagramViewer
    // components/RailroadDiagramViewer.tsx
    interface RailroadDiagramViewerProps {
      grammarCode: string;
      options: RailroadOptions;
      onError: (error: Error) => void;
      onGenerated: (result: GenerationResult) => void;
    }
    
  3. Implement SVG Rendering
    • SVG display component
    • Basic zoom and pan
    • Export functionality

Deliverables:

Week 7-8: Parse Tree and Grammar Graph Viewers

Goal: Implement visualization components for parse trees and grammar graphs

Tasks:

  1. Setup ReactFlow Integration
    npm install reactflow
    
  2. Implement ParseTreeViewer
    • Convert parse tree data to ReactFlow format
    • Interactive node exploration
    • Zoom and fit controls
  3. Implement GrammarGraphViewer
    • Convert grammar rules to graph format
    • Rule relationship visualization
    • Interactive exploration

Deliverables:

Week 9-10: Visualization Panel Integration

Goal: Integrate all visualization components into unified panel

Tasks:

  1. Port VisualizationPanel
    • Tabbed interface for different visualizations
    • State management between tabs
    • Consistent styling
  2. Coordinate Visualization Updates
    • Automatic updates when grammar changes
    • Loading states and error handling
    • Performance optimization
  3. Export Integration
    • Unified export functionality
    • Multiple format support
    • Download management

Deliverables:

Phase 3: Advanced Features (8 weeks)

Week 11-12: Debugging Tools

Goal: Implement debugging and analysis tools

Tasks:

  1. Port DebuggingPanel
    • Step-by-step debugging interface
    • Speed controls
    • Multiple debug views
  2. Implement Debug Components
    • CharacterInspector
    • TokenStreamViewer
    • StateInspector
  3. Real-time Debug Communication
    • SignalR integration for debug events
    • Live state updates
    • Debug session management

Deliverables:

Week 13-14: Theme System and Polish

Goal: Implement theming and improve user experience

Tasks:

  1. Port ThemeManager
    // services/ThemeManager.ts
    export class ThemeManager {
      getAvailableThemes(): Theme[]
      setCurrentTheme(name: string): void
      getCurrentTheme(): Theme
    }
    
  2. Implement Theme Switching
    • Theme selector component
    • Dynamic theme application
    • Theme persistence
  3. UI Polish and Optimization
    • Performance improvements
    • Loading states
    • Error boundary components

Deliverables:

Week 15-16: Testing Infrastructure

Goal: Implement comprehensive testing

Tasks:

  1. Setup Testing Framework
    npm install @testing-library/react @testing-library/jest-dom vitest
    
  2. Port and Adapt Tests
    • Component unit tests
    • Integration tests
    • API client tests
  3. Add E2E Testing
    • Playwright or Cypress setup
    • Critical user flow tests
    • Cross-browser testing

Deliverables:

Week 17-18: Desktop Integration (Optional)

Goal: Implement Electron desktop app support

Tasks:

  1. Electron Setup
    npm install electron electron-builder
    
  2. Port ElectronIntegration
    • File system access
    • Native menu integration
    • Desktop-specific features
  3. Build and Packaging
    • Cross-platform builds
    • Auto-updater integration
    • Distribution setup

Deliverables:

Phase 4: Advanced Features and Polish (6 weeks)

Week 19-20: Standalone Web Viewer

Goal: Create standalone railroad diagram web viewer

Tasks:

  1. Port Web Viewer Components
    • Modern UI components (shadcn/ui)
    • Advanced diagram controls
    • Animation system
  2. Standalone Application Setup
    • Separate Vite project
    • Independent deployment
    • Embedding capabilities

Deliverables:

Week 21-22: Advanced Editor Features (Optional)

Goal: Implement Blockly visual editor

Tasks:

  1. Blockly Integration
    npm install blockly
    
  2. Grammar Block Definitions
    • Custom blocks for grammar constructs
    • Block-to-code generation
    • Code-to-block parsing
  3. Visual Editor Interface
    • Blockly workspace integration
    • Bidirectional synchronization
    • Custom toolbox

Deliverables:

Week 23-24: Final Polish and Documentation

Goal: Finalize implementation and create documentation

Tasks:

  1. Performance Optimization
    • Code splitting
    • Lazy loading
    • Bundle optimization
  2. Documentation
    • User guide
    • Developer documentation
    • API documentation
  3. Deployment Preparation
    • Production builds
    • Docker containerization
    • Deployment scripts

Deliverables:

Risk Mitigation

Technical Risks

  1. Integration Complexity: Start with simple API endpoints and gradually add complexity
  2. Performance Issues: Implement monitoring and profiling early
  3. Cross-platform Compatibility: Test on multiple platforms throughout development

Schedule Risks

  1. Feature Creep: Maintain strict phase boundaries
  2. Dependency Issues: Have fallback options for critical dependencies
  3. Resource Constraints: Prioritize core features over nice-to-have features

Success Metrics

Phase 1 Success Criteria

Phase 2 Success Criteria

Phase 3 Success Criteria

Phase 4 Success Criteria

Resource Requirements

Development Team

Infrastructure

This roadmap provides a structured approach to implementing the UI capabilities while maintaining integration with the existing C# backend and ensuring a professional, maintainable solution.