1. Find a grammar for L(G) = {All bit strings with twice as many 1s as 0s}.
2. Find a grammar for L(G) = {w | | w | is odd, ∑ = (0,1)}.
3. Find a grammar for the odd palindromes over {a, b, c}.
1. Find a grammar for L(G) = {All bit strings with twice as many 1s as...
consider all bit strings of length 12 How many have 8 0s and 4 1s that have exactly 3 consecutive 1s (allow 4 consecutive 1s)? A 90 В 72 С 45 D 36 E 9 consider all bit strings of length 12 How many have 8 0s and 4 1s that have exactly 3 consecutive 1s (allow 4 consecutive 1s)? A 90 В 72 С 45 D 36 E 9
Let A be the set of all bit strings of length 10. 1. How many bit strings of length 10 are there? How many bit strings of length 10 begin with 1101? How many bit strings of length 10 have exactly six 0's? How many bit strings of length 10 have equal numbers of O's and 1's? How many bit strings of length 10 have more O's than 1's? a. b. c. d. e.
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....
1. Give a context-free grammar for the set BAL of balanced strings of delimiters of three types (), and . For example, (OOis in BAL but [) is not. Give a nondeterministic pushdown automata that recognizes the set of strings in BAL as defined in problem 1 above. Acceptance should be by accept state. 2. Give a context free grammar for the language L where L-(a"b'am I n>-o and there exists k>-o such that m-2*ktn) 3. Give a nondeterministic pushdown...
1. Let £ = {0,1} and consider the language L of all binary strings of odd length with a 0 in the middle. Give a Turing machine that decide L.
CFG questions 1. True or false? Given G: S → aSbSÍ bSaS | λ, L(G) = EQUAL. 2. Provide a grammar for all words that are not palindromes. 3. Provide a grammar for L = { a,b' : is js 2 4. Provide a grammar for L = { aibak: i + j = k }. 5. Provide a grammar for L = { aba: i + k = j).
1. Who are language descriptions intended for? Consider the following grammar: ab b | b a | a Which of the following sentences are in the language generated by this grammar? (DONE) a) baab ==> YES b) bbbab ==> NO c) bbaaaaaS ==> NO d) bbaab ==> YES 2. Write a BNF grammar for the language consisting of binary strings (any combination of 0s and 1s) of at least 2 digits.
Problem 3 (Counting binary strings) 20 marks/ Consider all bit strings of length 15. 1. How many begin with 00? 2. How many begin with 00 and end with 11? 3. How many begin with 00 or end with 10? 4. How many have exactly ten 1's? 5. How many have exactly ten 1's such as none of these 1's are adjacent to each other? Provide detailed justifications for your answers. Problem 3 (Counting binary strings) 20 marks/ Consider all...
(20) Let L be the language over {a,b,c} accepting all strings so that: 1. No b's occur before the first c. 2. No a's occur after the first c. 3. The last symbol of the string is b. 4. Each b that is not the last symbol is immediately followed by at least two c's. 5. There are exactly as many a's as b's. Construct a context-free grammar generating L. You do not need an inductive proof, but you should...
How to prove that the grammar G is not LL(1) The grammar is: L => LE | E E => (C) | (F) | V | T C => ifEE | ifEEE F => +L | -L | *L | printL V => a | b | c | d T => 0 | 1 | 2 | 3