Regular Expression
Write a regular expression that matches all strings over the alphabet {a, b, c} that contain: Starts and ends with a
a(a*b*c*)a /( a / a(a/b)*a)
At most one a
b*c*/b*c* a b*c*
At least two a's
b*c* a b*c* a b*c*
An even number of a's
(b*c* a b*c* a b*c*)+
Number of a's plus number of b's is even
Write a regular expression to describe all dates of the form Month DD, YYYY, where Month consists of any string of upper or lower case letters, the date is 1 or 2 digits, and the year is exactly 4 digits. The comma and spaces are required.
Write a regular expression for each of the following:
Strings over the alphabet {a, b, c} where the first a precedes the first b. c*a[ac]*b[abc]*
Strings over the alphabets {a, b, c} with an even number of a’s. (b*c* a b*c* a b*c*)+ / (aa/b/c)*
Binary numbers that are multiples of four.
( 1/0 1/0 1/0 1/0)* / (0*[01]*00 | 0+)
Binary numbers that are greater than 101001.
Strings over the alphabet {a, b, c} thar don’t contain the contiguous substring baa. ([ac]*b(c/a[^a])[ac]*b*)+/[ac]+
Identify the lexeme that makes up the tokens in the following programs. Give reasonable attribute vcalues for the tokens. Pascal
Function max ( i, j : integer) : integer ; {
return maximium of integers i and j }
begin
if i > j then max := i
else max := j
end;
C
Int max ( i, j) int i, j;
/* return maximium of integers I and j */
{ return i > j? i:j; }
Draw the Transition Diagram for relational operators.
Please join StudyMode to read the full document