nom
nom copied to clipboard
Question - Recipe to parse in look-ahead manner
Hi developers,
I'm writing a SQL parser with nom and encounter some issues that the order of alt
is significant and even when nested rules the code can be hard to debug.
One of the most subtle case is the I often try to "find" the possible longest branch and push it in the very beginning. With parser combinations the longest branch in one call graph may not retain from another call graph.
Parsers like ANTLR and Bison use LALR(1) or LL(*) algorithm to look-ahead characters so that it always try to make a longest match. I used to write parsers in this theory and I find nom supports peek
/ condition
/ etc.. Thus, I wonder if there is existing recipes or projects follow the same flavor and can show as an example to learn from.