12

I cannot find any complete description about LL(*) parser, such as ANTLR, on Internet.

I'm wondering what is the difference between an LL(k) parser and an LL(*) one and why they can't support left-recusrive grammars despite their flexibility.

2 Answers 2

5

Here is an article (by Terence Parr, the author of antlr) about LL(*) grammar analysis: article with a nice example of what is LL(*) but not LL(k), for any k.

Another good reference (and much more complete) is the "Definitive ANTLR Reference", again by Terence Parr, and the original journal article describing how antlr works [pdf].

2
  • The article link is not available now
    – LeeR
    Dec 15, 2019 at 12:04
  • Updated the link to reference the new wiki. The article is also available in the web archive
    – tonio
    Dec 16, 2019 at 9:04
1

When ever you see this it generally the amount of token look ahead in order to parse the language.

This is the same thing for LR parser.

So k is the maximum mount of token that the parer will fetch before taking a decision. Be aware that the more k is hight the harder the parser will be unless you use a generator (ANTLR, yacc, bison, ...).

LL parser use a top down approach which mean that it will look for the deepest tree. Because of that left recursion will make an infinitively deep tree and will break the parser.

AFAIK Most of the language use LR parser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.