ANSWER
S -> 1B1 | 0A1
B -> 0B0 | 1B1 | 0A1
A -> 1A0 | #
EXPLANATION
To avoid leading zeros, taken 1B1 to let the string start with 1
S -> 0A1 is the base case where 0#1 can be formed
B is for matching numbers
B -> 0A1 is for i+1th string check
CONSTRUCT A CFG for the following language= A = 2 bi #bire lixo be denotes binary...
Construct CFG
(b) (3 points) CFG: L2 = {wwR | w is a binary string and contains exactly one 1 }, WR is the reverse of w.
10. Consider the following CFG: Is the language generated by this CFG a regular language? If so, give a regular expression denoting it. If not, prove it.
10. Consider the following CFG: Is the language generated by this CFG a regular language? If so, give a regular expression denoting it. If not, prove it.
can you plzz do question 1 and 2
Question 1. Design a CFG for the language over = {1, #} whose elements consist of every pair of distinct, #-separated unary values: L = {rı#x2 | 21, 22 € 1", 21 * x2}. Question 2. Design a CFG for the language of binary strings that contain at least one 1 in their second half: L = {uv | UE (OU 1)", v € OU 1)*1(0U 1)", [u '}. Question 3. This...
Please answer a-f
Answer all the following questions. (a) Find a CFG for the language defined by a' (b) Find a CFG for the language defined by b (c) Find a CFG for the language defined by a'b. (d) Find a CFG for the language defined by ab. (e) Find a CFG for the language defined by a"b2n. (f) Find a CFG for the language defined by an + b 2n.
Input alphabet {a,b 1. write the CFG for the language of palindromes (5 points) 2. Convert this into PDA (state the accepting condition) (10 points) . Write a PDA for this language that satisfies the conditions required to convert it into CFG (5 points) 4. Convert the PDA from Q3 into CFG (10 points)
Input alphabet {a,b 1. write the CFG for the language of palindromes (5 points) 2. Convert this into PDA (state the accepting condition) (10 points) ....
Construct a TM Ms which decrements a binary number. The input to Ms is a string over (0,1). If the input is the base-2 representation of a positive integer number n, your TM must compute the base-2 representation of n-1. Otherwise your TM must reject the input. The output must have the same number of symbols as the input, which may have leading 0 symbols. The most significant bit of numbers is on the left. Submit a representation of M3...
2. Find a CFG for the language of words, over alphabet 2 - (a,bl, where th two letters are different from the last two letters (first two letters are the same, likewise last two letters are the same), i.e. if it start with aa it will end with bb and vice versa. (10 points) first
Answer these questions
Construct regular expressions for the following languages: i. Even binary numbers without leading zeros ii, L-(a"b"(n + m) is odd) ii L fa"b"l. n 2 3, m is odd) ni m.
Give a Context Free Grammar (CFG) for the following language: L = { w | the number of a’s and the number of b’s in w are equal, ∑= {a, b} }
3. Decide whether the following language is a CFL. If your answer is “yes”, construct a CFG; if your answer is “no”, prove it using the pumping lemma. L = {xayb | X, Y E {a,b}* and x, y has the same number of a’s}.