Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> back when it was considered impossibly impractical (the "dragon book" said so!)

Yes, with some optimizations (e.g., Pager's algorithm), LR(1) can be practical; in langcc we even implement LR(k), and this is also practical for many real-world grammars.

However, a key observation is that even LR(k) is not enough for many industrial language features. You may enjoy reading the companion technical report for langcc, which delves deep into the underlying parsing theory and proposes a number of new techniques:

https://arxiv.org/pdf/2209.08383.pdf



> However, a key observation is that even LR(k) is not enough for many industrial language features.

Yes, although sometimes a minor hack is all that's needed. For C/C++ you can maintain a symbol table while parsing, then have your "lexer" return a different token for a type-name vs other identifiers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: