www.vustudents.ning.com

 www.bit.ly/vucodes + Link For Assignments, GDBs & Online Quizzes Solution www.bit.ly/papersvu + Link For Past Papers, Solved MCQs, Short Notes & More

# CS606 Assignment 3 fall 2019

Questions No 01                                                      12+8=20Marks

Consider the grammar given below:

S → XaXb

S → Yb

X → €

Y → €

Where € (epsilon) is empty string.

1. Find First and Follow sets for above grammar. [12]
2. Construct LL (1) parsing table. [8]

Good Luck!

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

Views: 1253

### Replies to This Discussion

Our main purpose here discussion not just Solution

Students having same subject can start discussion here to solve assignment, GDB & Quiz and can clear their concepts until solution is provided.

P.S:    Please always try to add the discussion in proper format title like “CS101 Assignment / GDB No 01 Solution & Discussion Due Date: ___________”

Then copy Questions from assignment file and paste in Discussion.

http://bit.ly/vucodes (For Assignments, GDBs & Online Quizzes Solution)

http://bit.ly/papersvu (For Past Papers, Solved MCQs, Short Notes & More)

kisi ke pas solution ha to upload kre.

Kisi pass solution ha tu please share kare

# CS606 Assignment 3 Solution 2020

Cs606 assignment

[23/01, 21:33] Waqas Ahmad: a) The FIRST of a sentential form is the set of terminal symbols that lead any sentential from derived from the very first sentential form. In this particular case X and Y only derive the empty string and as a result the empty string is the FIRST set of both non-terminal symbols X and Y. The FIRST of S, however, includes “a” as in the first production once can derive a sentential form that starts with an “a” given that X can be replaced by the empty string. X similar reasoning allows you to include “b” in the FIRST(S).
summary: FIRST(X) = {e}, FIRST(Y) = {e}, FIRST(S) = {a, b}

The FOLLOW set of a non-terminal symbol is the set of terminals that can appear after that non-terminal symbol in any sentential form derived from the grammar’s start symbol. By definition the follow of the start symbol will automatically include the \$ sign which represents the end of the input string. In this particular case by looking at the productions of S one can determine right away that the follow of X includes the terminal “a” and “b” and that the FOLLOW of Y includes the terminal “b”. Given that the non-terminal S does not appear in any productions, not even in its own productions, the FOLLOW of S is only \$.
summary: FOLLOW(S) = {\$}, FOLLOW(X) = {a, b}, FOLLOW(Y) = {b}.

b) YES, because the intersection of the FIRST for every non-terminal symbol in empty. This leads to the parsing table for this LL method as indicated below. As there is no conflict in entry then grammar is clearly LL (1).
[23/01, 21:33] Waqas Ahmad: a b \$
S S→XaXb S → Yb
A X→ε X→ε
B Y→ε

waqas ahmed b likhna lazmi h kia ans ma

1

2

3

4

5

## Latest Activity

44 seconds ago
48 seconds ago
+ M.Tariq Malik added a discussion to the group CS202 Fundamentals of Front End Development

### CS202 Assignment No 03 Fall 2020 Solution & Discussion Due Date: 28-01-2021

1 minute ago
9 minutes ago
Arslan Mushtaq and rukhsana joined + M.Tariq Malik's group

### CS411 Visual Programming

9 minutes ago
+ ! ! Pagal Dewani ! ! + and Siddiq khan kakar are now friends
12 minutes ago
Amna Bhatti liked Amna Bhatti's discussion Qabool hai
15 minutes ago
Amna Bhatti posted a discussion

### Qabool hai

15 minutes ago
Ammara Sabir posted a discussion

### !!!!!!Muhabbat routh jaye tu@@

20 minutes ago
Salaar and Abrish joined Virtual University of Pakistan
40 minutes ago
1 hour ago
rukhsana added a discussion to the group CS411 Visual Programming

1 hour ago