Sometimes you have to pivot to get the right answer
This title could be clearer and more informative.Try out Clickbait Shieldfor free (5 uses left this month).
A live coding session (day two) building a parser generator in Zig for parsing SIP protocol headers defined in BNF grammars. The session covers refactoring the initial approach to support anonymous rules by introducing a prepass step that converts nested sequences and 'one-of' constructs into named rules. Key challenges encountered include Zig's type resolution limitations with anonymous structs and optional return types, block ID allocation for inline code generation, and mutable vs. constant slice handling. By the end, the generator successfully handles anonymous rule extraction and basic sequence/one-of parsing, with sequences planned for the next session.
Sort: