1

I have a bit of trouble understanding the definition of LL(k) grammars.

Here it's defined as:

for every pair of production rules $A\rightarrow α$ and $A \rightarrow β$ the following condition holds.
$\text{FIRST}_k$ ( $\text{α FOLLOW}_k$ (A)) $\cap$ $\text{FIRST}_k$ ( $\text{β FOLLOW}_k$ (A)) $=\emptyset$

What does this mean concretely? What is the subscript $_k$?
Why is it for a "pair of production rules"?

Raphael
  • 73,212
  • 30
  • 182
  • 400
mavavilj
  • 579
  • 7
  • 23

1 Answers1

5

It's actually a definition of a strong LL(k) grammar.

First of all, see Raphael's comment.

In short, the condition means that while parsing $A$ you can choose the next production rule in a deterministic manner using only the next $k$ lookahead symbols.

An important thing is you don't need any context for that decision, i.e. you don't need to remember the previous steps in the left-most derivation that led you to the non-terminal $A$ to parse $A$ itself.

By the way, every LL(1) grammar is strong, but there are non-strong LL(k) grammars, $k > 1$.

If you need a more detailed explanation, then I think it's better to use a book for that (it's too long for an answer here). I'd suggest "Parsing Techniques - A Practical Guide" by Dick Grune et al.

Anton Trunov
  • 3,499
  • 1
  • 19
  • 26