12/30/2025 at 3:30:00 PM
In rust I really like the grmtools set of tools: https://github.com/softdevteam/grmtools.It is lexx/yacc style lexer and parser generation and generates an LR1 parser but using the CPCT+ algorithm for error recovery. Iirc the way it works is that when an error occurs, the nearest likely valid token is inserted, the error is recorded and parsing continues.
I would use this for anything that is simple enough and recursive descent for anything more complicated and where even more context is needed for errors.
by sureglymop
12/30/2025 at 5:16:12 PM
I always feel that when saying lex/yacc style tools, it comes with a lot of preconceived notions that using the tools involves a slow development cycle with code gen + compilation steps.What drew me to the grmtools (eventually contributing to it) was that you can evaluate grammars basically like an interpreter without going through that compilation process. Leading to a fairly quick turnaround times during language development process.
I hope this year I can work on porting my grmtools based LSP to browser/wasm.
by ratmice
12/31/2025 at 8:26:10 PM
I've seen your commits, thank you sincerely for your work!by sureglymop