Awesome q2a theme
0 votes

Consider the following grammarsG1 and G2

G1: S→ aS | ε

G2: S→Sa | ε

Select the correct option.


G1 and G2 generate different parse tree for all strings.



L(G1) ≠ L(G2).



G1 is LR(0) while G2 is not LR(0)



G2 is LR(0) while G1 is not LR(0)

in Compiler Design by (698 points) | 26 views
1 is false, the empty string has the same parse tree.
2 is false, since only the direction of recursion is changing, and nothing else.

1 Answer

0 votes
$A) \  \text{False} $ as $G_1$ and $G_2$ both have same trees for $\large \epsilon$

$B) \ \text{False}  $ both $G_1$ and $G_2$ produce the same result.

$C) \ \text{False} \ $ Intital state contains $S \rightarrow \  .$ and this production in table will be in every column (action) which will be in conflict with in column of terminal $a$ where $S \rightarrow aS$ is placed.

$D) \ \text{True}$
by (505 points)
Will D) not contain reduce reduce conflict?
Which state which column?
In 1st state, I mean $I_{0}$
There is only 1 reduce move how you are getting conflicts?
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
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
Top Users Feb 2020
  1. shashin

    363 Points

  2. Shaik Masthan

    79 Points

  3. SuvasishDutta

    39 Points

  4. srestha

    33 Points

  5. Mk Utkarsh

    32 Points

  6. neeraj_bhatt

    31 Points

  7. !KARAN

    30 Points

  8. Debapaul

    23 Points

  9. Pratyush Priyam Kuan

    18 Points

  10. kalra05

    18 Points

Monthly Top User and those within 60% of his/her points will get a share of monthly revenue of GO subject to a minimum payout of Rs. 500. Current monthly budget for Top Users is Rs. 75.
3,331 questions
1,581 answers
89,916 users