/    /  Compiler Design-Non- Recursive Predictive Parsing

Non- Recursive Predictive Parsing

 

Non-Recursive predictive parsing uses a parsing table that shows which production rule to select from several alternatives available for expanding a given non-terminal and the first terminal symbol that should be produced by that non-terminal. The parsing table consists of rows and columns where there are two for each non-terminal and a column for each terminal symbol including S, the end marker for the input string.  

 

Each entry M[A, a] in a table is either a production rule or an error.

 

It uses a stack containing a sequence of grammar symbols with the $.

 

A symbol is placed on the bottom indicating the bottom of the stack. Initially, the start symbol resides on top. The stack is used to keep track of all the non-terminals for which no prediction has been made yet.

 

The parser also uses an input buffer and an output stream.

 

The string to be parsed is stored in the input buffer.

 

The end of the buffer uses a $ symbol to indicate the end of the input string.

 

Reference Link

Non- Recursive Predictive Parsing