edited by
557 views
2 2 votes

Consider the following arammar $G$ :$$
\begin{aligned}
& S \rightarrow(L) \mid a \\
& L \rightarrow L, S \mid S
\end{aligned}
$$
Which of the following statement(s) is/are TRUE regarding the parsing of grammar $G$ ?

  1. THE GRAMMAR IS $\mathrm{LR(0)}$.
     
  2. THE GRAMMAR IS $\mathrm{LL(1)}$.
     
  3. THE grammar is $\mathrm{SLR(1)}$.
     
  4. THE GRAMMAR IS AN OPERATOR GRAMMAR.

5 Answers

1 1 vote

B, D

Conflicts occur in both SLR(1) and LR(0) 

1 flag:
✌ Edit necessary (vishwajeet_kumar)
0 0 votes
option B,C,D
2 flags:
✌ Edit necessary (vishwajeet_kumar “B fails because there is left recursion”)
✌ Edit necessary (Nav_s “It contain left recursion in option B”)
0 0 votes
Option A,B,C are correct (from their respective tables)

For option D:

An operator grammar is defined by two strict rules:
1. It contains no ε‭‬-productions.
2. No two non-terminals are adjacent on the right-hand side of any production.

Hence, option D is also correct.
0 0 votes

A,C,D  are correct  because at augmented production there is only production of S. since dot is not present at front of L.                                 

0 0 votes
From DFA construction grammar is LR(0) that makes it SLR(1)

Due to left recursion in L->L,S it is not LL(1)

Grammar is operator as no adjacent non-terminals in RHS.

So, Options A,C,D are correct.
Answer:
Position:
Show:

Related questions

2 2 votes
3 3 answers
540
540 views
GO Classes asked Feb 4
540 views
A lexical analyzer is designed for a new language with the following rules for token generation:$\mathrm{KEYWORD1}: \verb|if|$ $\mathrm{KEYWORD2}: \verb|iff|$ $\mathrm{ID...
1 1 vote
2 2 answers
303
303 views
GO Classes asked Feb 4
303 views
Consider the following Syntax Directed Translation (SDT) scheme where $S$ is the start symbol and $id.\mathrm{val}$ represents the numerical value of an identifier:$$\beg...
5 5 votes
2 2 answers
301
301 views
GO Classes asked Feb 4
301 views
Consider a Bottom-Up parser for a grammar $G$. During the parsing of an input string $w$, the parser reaches a configuration where the stack contains the prefix $\alpha$ ...
2 2 votes
2 2 answers
307
307 views
GO Classes asked Feb 4
307 views
Which of the following statement(s) is/are TRUE regarding Lexical Analysis and Regular Expressions?The number of states in a minimal Deterministic Finite Automaton (DFA) ...