REGULAR GRAMMAR FOR SET OF ALL EVEN NUMBERS
Last digit of the number will be even, which is taken care by the
production S`.
S-> 0S | 1S | 2S | 3S | 4S | 5S | 6S | 7S | 8S | 9S |
S`
S`-> 0 | 2 | 4 | 6 | 8
REGULAR GRAMMAR FOR SET OF ALL ODD NUMBERS
Last digit of the number will be ODD, which is taken care by the
production S`.
S-> 0S | 1S | 2S | 3S | 4S | 5S | 6S | 7S | 8S | 9S |
S`
S`-> 1 | 3 | 5 | 7 | 9
REGULAR GRAMMAR TO GENERATE THE SET OF ALL INTEGERS
BEGINING WITH 8
HERE THIS PRODUCTION BEGINS THE NUMBER WITH 8, AFTER 8 WE WILL HAVE
0, AND 2 AND 4 CONSECUTIVELY, WHICH IS TAKEN CARE BY EACH
PRODUCTION.
S-> 8A | 8
A-> 0B | 0
B-> 2C | 2
C-> 4D | 4
D-> 6E | 6
E-> S
QUESTION 9:-
The first digit can either be 3 or 7, second digit can either be 2 or 6, and so on...
S-> 3A | 7A | 3 | 7
A-> 2S | 6S | 2 | 6
If there is anything that you don not understand, then please mention it in the comments section.
Design a regular grammar to generate the set of all even integers. Design a regular grammar...
Design a regular grammar to generate the set of all odd integers that are greater than or equal to 50.
Construct context-free grammars that generate the given set of
strings. If the grammar has more than one variable, we will ask to
write a sentence describing what sets of strings expect each
variable in the grammar to generate. For example, if the grammar
was:
I could say "C generates binary strings of length one, E
generates (non-empty) even length binary strings, and O generates
odd length binary strings." It is also fine to use a regular
expression, rather than English,...
Construct context-free grammars that generate the given set of
strings. If the grammar has more than one variable, we will ask to
write a sentence describing what sets of strings expect each
variable in the grammar to generate. For example, if the grammar
was:
I could say "C generates binary strings of length one, E
generates (non-empty) even length binary strings, and O generates
odd length binary strings." It is also fine to use a regular
expression, rather than English,...
For each of the following, construct context-free grammars that generate the given set of strings. If your grammar has more than one variable, we will ask you to write a sentence describing what sets of strings you expect each variable in your grammar to generate. For example, if your grammar were: S → EO E → EE CC 0+ EC C+01 We would expect you to say “E generates (non-empty) even length binary strings; O generates odd length binary strings;...
Question 1 - Regular Expressions Find regular expressions that define the following languages: 1. All even-length strings over the alphabet {a,b}. 2. All strings over the alphabet {a,b} with odd numbers of a's. 3. All strings over the alphabet {a,b} with even numbers of b’s. 4. All strings over the alphabet {a,b} that start and end with different symbols. 5. All strings over the alphabet {a, b} that do not contain the substring aab and end with bb.
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...
Write down the regular expressions for the following set of strings over {a, b}: 1.Strings that contain no more than one occurrence of the string aa. 2.All strings containing aba: 3.All strings of odd length 4.A string in this language must have at least two a's. 5.All strings that begin with a, and have an even number of b Bonus - All strings with “a” at every odd position
Design a DFA that accepts the set of all strings with 3 consecutive zeros at anywhere?
1. Use a Regular Expression to define the set of all bit strings
of one or more 0's followed by only a 1.
2. Use a Regular Expression to define the set of all bit string
of two or more symbols followed by three or more 0's.
3. Are these two grammars the same?
a. S-> aSb|ab|λ
b. S-> aAb|ab A->aAb|λ
4. Use the process of elimination to find the language of the
following FA: (see picture for diagram)
5....
J-J, f(x)--3, g : S → J, g(s) = nuniber of elements in the string 's', if is even. h : J-J, h(1)- r r if is odd - . where J denotes the set of integers and S denotes the set of all character strings. Calculate each of the following if they exist (if they do not exist explain why they do not exkt): (i) fo r (i) ho f(x), 8 marks) (ii) hofo g(test)
J-J, f(x)--3, g :...