Compiler Design and Construction - Old Questions

Question Answer Details

5.  Consider the following grammar:

        

    a.  Show steps of shift-reduce parsing for the input string id+id*id.

    b.  Identify conflicts during the parsing.

6 marks
Asked in 2070

Answer

AI Generated Answer

AI is thinking...

Official Answer

Given grammar;

a)

Input string: id + id * id


b)

Here, the shift-reduce conflict is encountered during the parsing. At $E+T, the conflict occured whether to reduce or shift during the parsing.