/    /  Compiler Design-Construction of RD Parser- (2)

Construction of RD Parser- (2)

 

Program for construction:

Procedure Є()
begin 
   T();
   ЄPRIME();
end;

Procedure ЄPRIME()
begin 
   if input symbol = ‘+’ then
begin 
   ADVANCED ();
   T();
   ЄPRIME();
end;
Procedure ЄPRIME()
begin 
   if input symbol = ‘*’ then
begin 
   ADVANCED ();
   F();
   ЄPRIME();
end;
end;

Procedure F()
begin
   If input symbol = ‘id’ then 
   ADVANCED();
else if input symbol = ‘(‘ then
   ADVANCED();
   E();
   If input symbol = ‘id’ then 
   ADVANCED();
   else ERROR();
end;

 

NOTE: When the calling procedure has no intention of trying another alternative or on failure, an error-correcting routine ERROR procedure can be invoked.

 

Reference Link

Construction of RD Parser- (2)