Consider the given CFG:
S ⟶ a X a X a , X ⟶ a X | b X | Λ
What is the language this CFG generates?
a) a language with all strings of at least 3 a's
b) a language with all strings of a's and b's
c) a language with all strings that start and end with a's with at most 3 a's
d) a language with all strings of at most 3 a's
e) None of the above
f) a language with all strings that start and end with a's with at least 3 a's
f) a language with all strings that start and end with a's
with at least 3 a's
I have below questions with answer! what if we get different question: Write a CFG without empty rules that generates the language: L = strings from (a ∪ b)*c* where the number of a's and b's together is equal to the number of c's. Answer: S → Asc | ε A → a | b ================================================== Write a CFG without empty rules that generates the language: L = strings from (ab ∪ cb)*c* where the number of a's and b's...
Find a CFG for the language with all words that start with a letter "a" or are of the form anb2n, n = 1, 2, 3, ... a) S-> aS | aSbb | null b) It is impossible to build such a CFG. c) S-> aS | abbS | null d) None of the above is correct. e) S-> aX; X->aX | bX | null
Give a context free grammar for the language L where L = {a"bam I n>:O and there exists k>-o such that m=2"k+n) 3. Give a nondeterministic pushdown automata that recognizes the set of strings in L from question 3 above. Acceptance should be by accept state. 4. 5 Give a context-free grammar for the set (abc il j or j -k) ie, the set of strings of a's followed by b's followed by c's, such that there are either a...
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...
Theory of Computation - Push Down Automata (PDA) and Context Free Grammars (CFG) Problem 1. From a language description to a PDA Show state diagrams of PDAs for the following languages: a. The set of strings over the alphabet fa, b) with twice as many a's as b's. Hint: in class, we showed a PDA when the number of as is the same as the number of bs, based on the idea of a counter. + Can we use a...
3 points) Question Three Consider the context-free grammar S >SS+1 SS 1a and the string aa Give a leftmost derivation for the string. 3 points) (4 poiots) (5 points) (3 points) sECTION IWOLAttcmpt.any 3.(or 2) questions from this.scction Suppose we have two tokens: (1) the keyword if, and (2) id-entifiers, which are strings of letters other than if. Show the DFA for these tokens. Give a nightmost derivation for the string. Give a parse tree for the string i) Is...
For context the class is about Automata, Computability, and Formal Languages I just need parts b & e done 14. Find grammars for E = {a, b} that gener- ate the sets of (a) all strings with exactly two a's. (b) all strings with at least two a’s. (c) all strings with no more than three a's. (d) all strings with at least three a’s. (e) all strings that start with a and end with b. (f) all strings with...
3) Construct a regular expression defining each of the following languages over the alphabet {a, b}. (a) L = {aab, ba, bb, baab}; (b) The language of all strings containing exactly two b's. (c) The language of all strings containing at least one a and at least one b. (d) The language of all strings that do not end with ba. (e) The language of all strings that do not containing the substring bb. (f) The language of all strings...
(5) Describe the strings in the set S of strings over the alphabet Σ = a, b, c defined recursively by (1) c E S and (2) if x є S then za E S and zb є S and cr є S. Hint: Your description should be a sentence that provides an euasy test to check if a given string is in the set or not. An example of such a description is: S consists of all strings of...
2. The following context-free grammar (CFG) has A-productions. S + XY | XYZ X + YXYZ | a | A Y + XZ | ZY | 6 | A Z YZ | XY | X | C Using the algorithm in Chapter 13, find another CFG that generates the same language except for the empty word, and that does not have any A-productions.