You are on page 1of 1

Eliminate left recursion, Computer First, Follow for following grammars:-

Grammar 1:-

SABD

A  aA | a | ε

B  bB | b | ε

DdD|d

Grammar 2:-

S  Type id ( Para )

Type int | char | float | void

Para  Para, id | id

Grammar 3:-

S à If ( Cond) { Stat }

Cond à id Relop id

Relop à < | > | <= | >=

Stat à id = Exp

Exp à Exp + Exp | Exp – Exp | Exp * Exp | id

Grammar 4:-

Sà While(Cond) { Stat ; }

Cond à id Relop id

Relop à < | > | <= | >=

Stat à id = Exp

Exp à Exp + Exp | Exp – Exp | Exp * Exp | id

You might also like