The Gateway to Computer Science Excellence
+42 votes

Consider the following two statements:

  • P: Every regular grammar is LL(1)
  • Q: Every regular set has a LR(1) grammar

Which of the following is TRUE?

  1. Both P and Q are true

  2. P is true and Q is false

  3. P is false and Q is true

  4. Both P and Q are false

in Compiler Design by Veteran (52.2k points) | 9k views

Hi, all previous GATE questions are already here- you can use the above google searchbar or use Prev Exams link in navbar.

There is a difference between Left linear grammar and left recursion. regular languages are either Left linear or Right linear. LL(1) does not accept left recursion. Left recursion is a kind of left-linear grammar. every left linear grammar can be converted into equivalent right linear grammar.

9 Answers

0 votes
A regular grammar can also be ambiguous also
For example, consider the following grammar,                             
S → aA/a
A → aA/ε
In above grammar, string 'a' has two leftmost
(1)   S → aA                      (2)   S → a
      S->a (using A->ε)
And LL(1) parses only unambiguous grammar,
so statement P is False.
Statement Q is true is for every regular set, we can have a regular
grammar which is unambiguous so it can be parse by LR parser. 

So option C is correct choice 
by Loyal (5.3k points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,645 questions
56,579 answers
101,776 users