This document contains an assignment on compiler construction involving three questions about SLR parsing. Question 1 involves constructing item sets and a parsing table for a grammar, then parsing an input string. Question 2 involves constructing a parsing table for another grammar and determining if it is SLR. Question 3 involves more item sets, a parsing table, and parsing another input string. The document provides grammars and instructions for each question.
This document contains an assignment on compiler construction involving three questions about SLR parsing. Question 1 involves constructing item sets and a parsing table for a grammar, then parsing an input string. Question 2 involves constructing a parsing table for another grammar and determining if it is SLR. Question 3 involves more item sets, a parsing table, and parsing another input string. The document provides grammars and instructions for each question.
Course No: CS-471 Course Name: Compiler Construction Due Date: Monday, 30-April Instructor: Tahir Iqbal Email ID: tahir.ikhan@gmail.com
Question-1: Given the grammar; S SaSb S
a) Construct the sets of items and draw the directed graph that connects them? b) Build the SLR(1) parsing table: a b $ S 0 1 2 3 4 5 6 7
c) Trace the sequence of shift and reduce actions when parsing the input string abaabb Show the contents of the stack during each step. Question-2: Given the Grammar; S Aa | bAc | dc | bda A d a) Construct the SLR parsing table for this grammar? b) Show that whether this grammar is SLR grammar or not?
FOLLOW S a , b , $
Question-3: Given the grammar; S E?S:S S E E a
a) Construct the sets of items and draw the directed graph that connects them? b) Build the SLR(1) parsing table: : ? a $ E S 0 1 2 3 4 5 6 7
c) Trace the sequence of shift and reduce actions when parsing the input string a?a:a Show the contents of the stack during each step.