LL (2) is a language that is not LL (1)

In order to further understand parsers and grammars, I am looking for (in our opinion, a simple) example of LL (2), but not LL (1). That is, a language that can be generated by LL (2), but not any LL (1).

Are there useful languages ​​in this class? Could I imagine a computer language that is LL (2) but not LL (1)?

+8
parsing grammar
source share
2 answers

Analysis methods from Grune and Jacobs are an example. An older version of this book can be found on the Internet at

http://dickgrune.com/Books/PTAPG_1st_Edition/BookBody.pdf

and an example is given on page 181.

+7
source share

Example mentioned in a book related to Gunther's answer:

S -> a SA | epsilon A -> a^kb S | c 

is a grammar describing the language LL (k + 1), which is not LL (k). In particular,

 S -> a SA | epsilon A -> ab S | c 

is a grammar describing LL (2), which is not LL (1).

+12
source share

All Articles