Chapter 4: Syntax Analysis

Shift reduce parsing .

. Bottom up parsing has two actions

. Shift : move terminal symbol from right string to left string

if string before shift is a .pqr

then string after shift is a p.qr

.Reduce : immediately on the left of "." identify a string same as RHS of a production and replace it by LHS

if string before reduce action is aß .pqr

and A ß is a production

then string after reduction is a A.pqr

There are two primary operations of a shift-reduce parser namely (1) shift and (2) reduce. In a shift action, the next input symbol is shifted from right string to the left string. For example, if string before shift is " a .pqr " then string after shift would be " a p.qr " . In a reduce action, the parser identifies a string which is same as the RHS of a production and replace it by the non-terminal at LHS. For example, if string before reduce action is " aß .pqr " and A ß is a production, then string after reduction is " a A.pqr " .