Site icon i2tutorials

Compiler Design-Construction of RD Parser

Construction of RD Parser

 

The following are the steps for constructing an RD Parser:

 

The RHS of the rule is directly converted into program code, symbol by symbol.

 

Example:

Construct an RDP for 

E ⟶ E + T / T

T ⟶ T * F / F

F ⟶ (Є) / id

 

Eliminating the immediate left recursion we get,

E ⟶ +TE’

E’ ⟶ +TE’ / Є

T ⟶ FT’ 

T’ ⟶ FT’ / Є

F ⟶ (Є) /id

 

 

Reference Link

Construction of RD Parser

Exit mobile version