AST Migration Plan Overview
AST Migration Plan Overview
Objective
Replace all string-based parsing in XMD with proper Abstract Syntax Tree (AST) parsing architecture.
Current State
- String manipulation using strchr, strstr, strncmp throughout codebase
- Direct text processing in process_set.c, process_directive.c, etc.
- Error-prone pattern matching without proper syntax validation
- Limited extensibility for new language features
Target State
- Full AST-based parsing with lexer โ parser โ interpreter pipeline
- Proper error handling with source location tracking
- Type-safe node structures following one-function-per-file rule
- Complete removal of string-based parsing code
Phases
- Phase 1: Core AST Infrastructure (ast_node, lexer_enhanced)
- Phase 2: Parser Implementation (recursive descent)
- Phase 3: AST Interpreter/Evaluator
- Phase 4: Migration of Existing Components
- Phase 5: String Parser Purge
- Phase 6: Testing and Documentation
Success Criteria
- All XMD directives parsed through AST
- Zero string-based parsing remaining
- Full test coverage maintained
- Performance equivalent or better
- Clean architecture following dev rules