Operator Precedence Parsing

Program in C to implement Operator Precedence Parsing :

ALGORITHM :

  1. Let the input string to be initially the stack contains, when the reduce action takes place we have to reach create parent child relationship.
  2. See IP to pointer to the first symbol of input string and repeat forever if only $ is on the input accept and break else begin.
  3. Let ‘d’ be the top most terminal on the stack and ‘b’ be current input IF(a<b) or a=b then Begin push ‘b’ onto the stack.
  4. Advance Input to the stack to the next Input symbol
    end;
    else if(a>b)
  5. Repeat pop the stack until the top most terminal is related by < to the terminal most recently popped else error value routine
  6. end;

C SOURCE CODE :

OUTPUT :

operator precedence parsing


Leave a Reply

Your email address will not be published. Required fields are marked *