1. The document provides regular expressions (REs) to represent various formal language concepts.
2. REs are provided to represent identifiers consisting of letters, digits and underscores; languages of strings containing 'a' and 'b' with certain substring patterns; and languages over binary digits avoiding consecutive zeros or ending in double zeros.
3. The REs use operators like concatenation, union, Kleene star and optional elements to concisely define the languages in a formal way.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
12 views
Write A Regular Expression For All Strings of A
1. The document provides regular expressions (REs) to represent various formal language concepts.
2. REs are provided to represent identifiers consisting of letters, digits and underscores; languages of strings containing 'a' and 'b' with certain substring patterns; and languages over binary digits avoiding consecutive zeros or ending in double zeros.
3. The REs use operators like concatenation, union, Kleene star and optional elements to concisely define the languages in a formal way.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Assignment II
1. Write a RE for Identifiers formed as follows: an identifier consists of one or more
letters (a‐z and A‐Z), digits (0‐9) and underscores (_). An identifier must begin with a letter and may not end with an underscore. The answer is below it: [a-z A-Z][A-zA-Z0-9]{0-20} And also it forgot about _ (Underline) and that must be [a-z A-Z_][a-zA-Z0-9_]{0-20} 2. Obtain the regular expressions for the languages given by: (a) L1 = {a2nb 2m+1|n>0, M>0} : look at the answer bellow the following in (i) & (ii) i. (a+b)*(∈ + a) + (a+b)*(bb) ii. (aa)*b(bb)* (b) L2 = {a, bb, aa, abb, ba, bbb, . . . } The answer is below the following (A+BB)* 3. Write a regular expression for all strings of a’s and b’s which contains the substring abba? The set of strings over {a, b} that contains the substrings aa or bb (a+b)*aa(a+b)* + (a+b)*bb(a+b)* 4. Obtain the regular expressions for the languages given by (c) L 3 = { w ∈ {0, 1}* | w has no pair of consecutive zeros} : The answer is bellow the following + 01)* (0 + λ)
(d) L4 = {Strings of 0's and 1's ending in 00}
R = 1 (0+1)* 0
Note: (a)& (b) i.e L1 & L2 are done in Question No.(2)
A Turing Machine Is A Mathematical Model of Computation That Defines An Abstract Machine That Manipulates Symbols On A Strip of Tape According To A Table of Rules