formal-languages

Why can't C++ be parsed with a LR(1) parser?

我的梦境 提交于 2019-11-25 23:58:25
问题 I was reading about parsers and parser generators and found this statement in wikipedia\'s LR parsing -page: Many programming languages can be parsed using some variation of an LR parser. One notable exception is C++. Why is it so? What particular property of C++ causes it to be impossible to parse with LR parsers? Using google, I only found that C can be perfectly parsed with LR(1) but C++ requires LR(∞). 回答1: There is an interesting thread on Lambda the Ultimate that discusses the LALR