• edited by
5,464 views
1 1 vote

Let G be a context-free grammar where G = ({S, A, B, C}, {a, b, d}, P, S) with the productions in P given below.

S → ABAC

A → aA ∣ ε

B → bB ∣ ε

C → d

(ε denotes the null string). Transform the grammar G to an equivalent context-free grammar G′ that has no ε productions

and no unit productions. (A unit production is of the form x → y, and x and y are non terminals).

2 Answers

5 5 votes

The solution is

S → ABAC /ABC/BAC/AAC/AC/BC/d

A → aA ∣ a

B → bB ∣ b

C → d

• edited by
3 3 votes

Answer given in gatebook  :  C->d is a unit production.

so first production will become S -> ABAd | BAd | AAd | ABd | Bd | d

A -> aA | a

B -> bB | b

A->aA/a ,B->bB/b comes from eliminating epsilon production,why we we remove C->d production(as the question says A unit production is of the form x → y, and x and y are non terminals).d is terminal i thing.

Position:
Show:

Related questions

0 0 votes
0 0 answers
580
580 views
Ashutosh_RS asked Mar 28, 2025
580 views
Eliminate left Recursion from the following Grammar: S->AB, A->BS|b, B->SA|a
1 1 vote
2 2 answers
761
761 views
lovish_bhatia asked Sep 12, 2023
761 views
Consider the following statements:(A) LL (k) grammars have one to one correspondence with DCFLs.(B) LR (k) grammars have one to one correspondence with CFLs. A is true bu...