


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!



Theory Assignment 2 Department of: COMPUTER SCIENCE Class/Program: BS(7-A,C,D) Due Date: 9 Nov 2022 11:59 AM Subject: Compiler Construction Instructor: Muhammad Nadeem Note: copying will lead to ZERO This is hand written assignment. You are required to write your Name and Registration Number on top of each paper of your assignment****. Scan assignment using any scanner tool (like CAMSCANNER), create a pdf , and upload to server, prior to due time. PLEASE DO NOT submit Hard Fprm No email will be accepted, except the students having registration issue. Parse trees MUST BE NEAT AND CLEAN. Not following the instructions will lead to marks deduction. Q1. you are required to convert following regular expression to equivalent CFG. [CLO-2 PLO-37] 00 11 (a+b)abb (0+1)0(0+1)0(0+1) (b + c)* a (b + c)* (a-z)
(cui)(w|a|h) Q2. Explain what is the purpose of a CFG, what are the basic ingredients of a CFG, explain each. [CLO-2 PLO-37] Q3. Consider the following CFG. [CLO-2 PLO-37] S→ aSa S→ bSb S→ c create parse trees for following input and show that either they are accepted or rejected. abbcba, abbcbba, abaccbba, abbbcbbba, abbcbbba, abbbba, abcba, abab
Q4. Consider the following grammar. (S, NP,VP,DET,N,PP,IV,TV,PREP are all single Non Terminal) [CLO-2 PLO-37] You are required to create parse trees for following sentences. fruit flies like an apple the apple eats the giraffe
they fish in december they fish in pakistan they fish in pakistan in december Q6.Consider the following grammar. (S,NP,VP,Det,Noun,Verb are non terminal) [CLO-2 PLO-37] draw parse tree for following sentences. These students eats a cake the cake eat these students a student eats these cakes the cake eats a student