I rewrote PostHog's SQL parser, 70x faster, while barely looking at the code
PostHog rewrote its SQL parser using AI-assisted coding with Claude, achieving a 70x speed improvement over the previous ANTLR-generated parser. The new hand-rolled parser, comprising 16K lines of code, maintains functional equivalence with the original for realistic queries while being significantly faster due to eliminating the abstraction layers and dynamic lookahead overhead of the ANTLR graph-walking interpreter. The parser was developed through multiple parallel Claude Code sessions with property-based testing and prompt engineering to handle edge cases and ensure correctness.