Zig day in Boston was a great time! I helped hack on a new parser for the Zig programming language. I learned two things.
An example is parsing the pub modifier keyword in Zig.
The rules for pub are a bit tricky: it can appear on any container declaration, so every variable definition or function definition in a struct can be pub, but it cannot appear before a local variable definition.
In effect pub cannot appear inside a function body, and this is a syntax error, not a semantic error.
Zig's official grammar solves this by creating a new AST node when it encounters pub.
Then the grammar has separate nodes for container declarations and for function body blocks.
The ZIRP (ZIg Resilient Parser) solution is different: when we encounter pub, we skip the token entirely, and just parse what comes after.
If some consumer of the AST wants to know whether a function declaration is pubpub block in the AST, avoiding extra nodes and complexity.
On reflection, this is a specific instance of two general patterns: