Write a right-linear CFG for the regular languages: (∑={0,1})
a. L = { w | w is a binary string which starts and ends with the same symbol}
b. L = { w | w is a binary string with at least three 0’s }
c. L = { w | w is a binary string with odd number of 0’s and even number of 1’s}
Ans-a: Assume S to be the start variable.



Ans-b: Assume S to be the start variable.




Ans-c: Assume S to be the start variable:




Write a right-linear CFG for the regular languages: (∑={0,1}) a. L = { w | w...
Give the regular expressions of the following languages (alphabet is ab): a. {w | w has a length of at least three and its second symbol is a b} b. {w | w begins with an a and ends with a b} c. {w | w contains a single b} d. {w | w contains at least three a's} e. {w | w contains the substring baba} d. {w | w is a string of even length} e. The empty...
Give regular expressions generating the languages of 1. {w over the alphabet of {0, 1} | w is any string except 11 and 111} 2. {w over the alphabet of {0, 1} | w contains at least two 0’s and at most one 1} 3. {w over the alphabet of {0, 1} | the length of w is at most 9} 4. {w over the alphabet of {0, 1} | w contains at least three 1 s} 5. {w over...
Give regular expressions describing each of the following regular languages over Σ = {0,1}: {w : w begins and ends with the same symbols} show work!
1. (Decidable languages) (c) (Prefix of a generated string) A string w is called a prefix of string s if s starts with w. i. Give a regular expression for all strings over alphabet Σ for which w is a prefix. ii. Let L = {(G, w) | G is a CFG, w is a string, and w is a prefix of some string s generated by G}.
1. (10 marks) Prove that the following languages are non-regular, using the Pumping Lemma. (a) (10 marks) L1 = {W € {0,1}* ||w| is odd, and the symbol in the very middle of the string is 0} For example, the strings 01011, 000000000 and 0 are in L1.]
Create DFA : a)L={w| w is a word that begins with 1 or 2,finishes with 2 or 3 and the number of the other symbols is even} alphabet={1,2,3}. b)L={w| w is a word that represents an integer in a binary form and when is divided by 4 the remaining is 3 (number&4=3)} alphabet={0,1} c)L={w| w is a word where every a is followed either from an odd number of b or from an odd number of c} alphabet={a,b,c} d)L={w| w...
For each of the languages listed below, give a regular expression that generates the lan- guage. Briefly justify your answer. (a) The set of strings over (a, b such that any a in the string is followed by an odd number of b's. Examples: bbbab E L, but abb f L. (b) The set of strings over fa, b in which there is an a in every even position and the total number of b's is odd, where the first...
1. Write regular expressions to capture the following regular languages: (a) The set of binary strings which have a 1 in every even position. (Note: odd positions may be either 0 or 1.) (b) The set of binary strings that do not contain 011 as a substring. (c) Comments in Pascal. These are delimited by (* and *) or by { and }, and can contain anything in between; they are NOT allowed to nest, however. 2. Write a DFA...
Regular expressions, DFA, NFA, grammars, languages
Regular Languages 4 4 1. Write English descriptions for the languages generated by the following regular expressions: (a) (01... 9|A|B|C|D|E|F)+(2X) (b) (ab)*(a|ble) 2. Write regular expressions for each of the following. (a) All strings of lowercase letters that begin and end in a. (b) All strings of digits that contain no leading zeros. (c) All strings of digits that represent even numbers. (d) Strings over the alphabet {a,b,c} with an even number of a's....
5. (5 points) Give context-free grammar that generate the following languages (1) (w is a binary string, and w starts and ends with the same symbol (2) the empty language (empty set)