Parsers don't have to be complicated

Introduction Years ago I started writing a proper shader front-end parser for bgfx and used the Lemon parser generator. It was small, it worked, but I never liked the code it produced. The generated output felt hard to read, and the code that generated the parser also felt alien to me. Every time the grammar changed I had to re-learn the shape of the resulting code. It solved the problem, but eventually I abandoned it.

AI Summary

The author describes their experience with parsing: using a parser generator like Lemon produced hard-to-read code, while ad-hoc hand-written parsers were repetitive and bug-prone. They wanted a middle ground—small, reusable primitives that handle common scanning tasks without generators or heavy dependencies.

Read Original → · Discuss with AI → · Share →
← Back to news