Coders Packet

Shift Reduce Parser Using C++

By Jahanvi Solanki

Shift Reduce Parsing is a way to reduce a string to the start symbol of a grammar. It. It is mainly used for the error-checking process. The code is done in C++

The packet contains a program for shift-reduce parsing that is done in C++, it also contains a .txt file that contains the grammar. The text file and CPP file should be in the same folder for the usage of the code. After compiling and running the code, an input is to give for which shift-reduce parsing would be done and it will be returned whether the string is accepted or not.
The data structure used here is stack.
The program here does two works which are shift and reduction. In the shift action, the current symbol in the input string is pushed into the stack whereas in reducing action the symbols are then replaced by the non-terminals.

Download Complete Code


  • sunil rachhoya :

    it is still asking about the input string although we have given the string in input.

  • Reply to this comment