@zaasmi said in CS606 Assignment 1 Solution and Discussion:
Task 1:
For regular expression below, construct an NFA using Thompson’s construction. (10 Marks)
R.E. = (y* xy* x)* y*
43407e94-3b07-4a76-ad67-3af3f378f29b-image.png
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→ε
@ramsha-kanwal
Simple reply the topic and upload file
ab to so hi jana chaye fr
@Nabeel-Chaudhary btay?
@Nabeel-Chaudhary w8 kru k so jau?
mery pas file hai pr mujhy idhr uplod ni krni aa rahi
@Nabeel-Chaudhary plz send me solution file at [email protected]
@Nabeel-Chaudhary bhai agr ap k pas file ha to send kr do plz
@ramsha-kanwal Give me your email or something i will send you a file
allah hi puchy ga
bta dy file hai k ni plz
@ramsha-kanwal File hai hi nahi in k pas
@zareen This does not make any sense. I also downloaded this type of sketch from internet. Its so confusing. The thing is our assignment is gone.
plz file send kr dy
@Nabeel-Chaudhary Solution idea posted so please follow these step as required assignment with minimum changes.