enhancementgood first issue
仓库指标
- 星标
- (109 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
Improve string formatting and debugging utilities
Description
Enhance string representation and debugging utilities throughout the codebase to make development and troubleshooting easier.
Current State
Several types have basic ToString instances using reprStr, but could benefit from more user-friendly string representations.
Proposed Implementation
Improve ToString instances and add debugging utilities.
Areas for Improvement
-
AST Pretty Printing (
regex/Regex/Syntax/Ast.lean):- Add human-readable AST formatting
- Show regex structure in a tree-like format
-
NFA Visualization (
regex/Regex/NFA/Basic.lean):- Add method to display NFA structure
- Show state transitions in readable format
-
Better Error Formatting:
- Enhance existing error messages
- Add color coding for terminal output (optional)
-
Regex Pattern Display:
- Add method to show compiled regex in readable form
- Display capture group information
Implementation Steps
- Create new
ToStringinstances that prioritize readability - Add optional debugging methods (prefixed with
debug_) - Ensure formatting works well in both terminal and programmatic contexts
- Add examples in documentation
Files to Modify
regex/Regex/Syntax/Ast.lean- Better AST formattingregex/Regex/NFA/Basic.lean- NFA visualization- Various files with
ToStringinstances
Testing
- Verify output is readable and helpful
- Test with complex regex patterns
- Ensure no performance impact on core functionality
Skills Required
- Basic functional programming
- String manipulation and formatting
- Understanding of data structure visualization
- No Lean theorem proving experience needed
Expected Outcome
Developers have better tools for understanding regex compilation and debugging issues, improving the development experience.