Parsing Advances
4 months ago
- #programming
- #parser
- #debugging
- Author writes a toy parser during Christmas break, inspired by Resilient LL Parsing Tutorial.
- Focus on producing syntax trees and diagnostics rather than bailing on first error.
- Pitfall: Infinite loops/recursion due to resilience (not consuming tokens).
- Example: Parsing function argument list may loop if expression doesn't consume tokens.
- Traditional solution: 'Fuel' mechanism and mental mapping of token-consuming functions.
- New solution: Assert parser advancement to materialize mental map in code.
- Benefits: Immediate error on non-advancement and explicit token-consuming function tracking.
- Base parser API introduced to implement this solution.
- Buggy function example provided to illustrate the initial problem.