3 ms·
Exactly. This is one of the many reasons why most parsers are written top-down. Bison, which is a bottom-up GLR parser generator, does token location tracking,
by himom 8y ago
Exactly. This is one of the many reasons why most parsers are written top-down. Bison, which is a bottom-up GLR parser generator, does token location tracking, but it doesn’t help with annotating code properly for human-readable warnings and errors. YACC was the UNIX inspiration for Bison, but it was LALR(1).
OTOH, top-down parsers LL(0), LL(1), LL(k) are far easier to maintain because there’s a straightforward correspondence of BNF to code. It’s not necessarily the fanciest