Compiler Design Spring 2010 (CSE344) Assignment # 1 Date of Submission: 1st March 2010 Instructor : Asma Sanam Larik Mode of Submission: Hand Written Question #1: Construct a Deterministic Finite Automata and write down Regular Expressions for the following languages: i. L={w | na (w)=2 , w Є (a,b)*} where : na (w) means number of a’s in w ii. Language over Σ = {a,b} in which every occurrence of a bb is followed by an a iii. Language over Σ = {a,b} that does not contain aaa as a substring iv. Language over Σ = {a,b} that accepts all the strings that do not end with ba v. The set of all strings beginning with a 1, that interpreted as a binary number is a multiple of 5. For example the strings 101, 1010 and 1111 are in the language but 0, 100 and 111 are not vi. Language that accepts all the strings over Σ = {a,b} that have both or neither aa and bb as substrings vii. Language of all the strings containing no more than one occurrence of string 00 over Σ = {0,1} (Note: The string 000 should be viewed as containing two occurrences of 00) Question #2: Describe the language accepted by the following automata: a) b) c) a b a b a b p q q p q q p {q} q r p q r s q {q} {q,r} *r q q *r q q *r s s q q *s 1 Compiler Design Spring 2010 (CSE344) Assignment # 1 Question #3: Convert the following є-NFA to DFA: a) c) є a b p {r} {q} {r} q1 q {s} {t} q2 r {q} {t} q3 *s *q4 t { s,t} є {q2,q3} {q4} {q2} a {q3} {q3} Question #4: Minimize the following DFA (Show all the necessary steps) q1 q2 q3 q4 *q5 a q2 q3 q4 q4 q4 b q1 q1 q5 q5 q5 Question #5: We can prove that two regular expressions aer equivalent by showing that their minimum-state DFA’s are same, except for the state names. Using this technique show that the following reqular expressions are equivalent: a) (a|b)* b) (a* |b*) * c) ((є |a) b*) * ------------------------------------------ Good Luck------------------------------------------ 2