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

后端 未结 6 1375

I was reading about parsers and parser generators and found this statement in wikipedia\'s LR parsing -page:

Many programming languages can be parsed

6条回答
  •  有刺的猬
    2020-11-22 02:45

    I think you are pretty close to the answer.

    LR(1) means that parsing from left to right needs only one token to look-ahead for the context, whereas LR(∞) means an infinite look-ahead. That is, the parser would have to know everything that was coming in order to figure out where it is now.

提交回复
热议问题