Shift reduce parser | Compiler Construction

Shift reduce parser performs two main operations;

  1. Shift
  2. Reduce

What is Shift?

Shift operation is used in shift-reduce parsing to push the current input symbol to the stack.

What is reduce?

Reduce operation is used in shift-reduce parsing to replace the symbols with non-terminal.

Example of Shift reduce parsing

Let’s begin with an example of CFG (Context-free grammar).

E-> E+E

E->0

E->1

Shift reduce parser Compiler Construction
Figure: Shift reduce parser Compiler Construction

Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,
2. Video lectures on Youtube
3. Email is only for Advertisement/business enquiries.