Table-Driven Parser Program Outline

 

program Parser(input,output,table)

{ declarations }

procedure Parse_Graph (top, flag)

{ parse input strings }

procedure Get_Table

{ read syntax table from file }

begin (Parser}

Get_Table;   {read syntax table definition}

read(sym);   {read first symbol}

top := 1;

Parse_Graph(top,flag);   {parse input string}

if eoln and flag{must be at end of line for valid string}

then writeln ('valid')

else writeln('invalid')

endif

end. {Parser}