# LL(K) Grammars Support

Chevrotain can be used to build parsers for LL(K) (opens new window) Grammars. This means that the number of lookahead tokens needed to disambiguate two alternatives must be a fixed number and known in advance.

For example given the grammar

   A B C |
   A B D |
   A B E

Chevrotain will look three tokens ahead to decide between the two alternatives.

But given the following grammar

   longRule B  |
   longRule C  |
   longRule D


Chevrotain will throw a an error during the parser initialization in this case. This is because there is no fixed number of tokens we can use to choose between the alternatives that is due to a potentially infinite number of "A" tokens that can appear before the "B" - "C" tokens.