2,239 views
5 votes
5 votes

Which of the following is TRUE regarding LL(0) grammar?

  1. We can have a LL(0) grammar for any regular language
  2. We can have a LL(0) grammar for a regular language only if it does not contain empty string
  3. We can have a LL(0) grammar for any regular language if and only if it has prefix property
  4. We can have a LL(0) grammar for only single string languages

1 Answer

5 votes
5 votes

LL(0) grammars have no lookahead. And since they follow Leftmost derivation, at each step the parser has to derive the string by seeing 0 symbols. => Parser sees nothing.

So whenever we have multiple choices for any Variable in the grammar, LL(0) fails.

Hence, LL(0) parser can only parse grammars that strictly generate one single string.

Option D

Answer:

Related questions

6 votes
6 votes
2 answers
1
Arjun asked Jan 26, 2019
1,691 views
If we merge states in LR(1) parser to form a LALR(1) parser, we may introduceshift-reduce conflictreduce-reduce conflictno extra conflictboth shift-reduce as well as redu...