Find a grammar for the language L = {a^n b^(2n+1) c^(3n-1) | 0 < n} (a) Give the grammar G. (b) Document the productions and the nonterminals of G. (c) Derive several representative strings with the grammar. (d) Prove by induction that for all w such that S ⇒G w the following relation between the number of a's and the number of c's holds: 3 × #a(w) + 1 = #c(w) (e) Where is the language L(G) in the Chomsky hierarchy? (The best answer is the most descriptive answer.)
Added by Kyle Q.
Step 1
(a) The grammar for the language L is: S → aSccc | B B → bBcc | ε (b) The productions and nonterminals of G are: Show more…
Show all steps
Your feedback will help us improve your experience
Akash M and 54 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Let $G=(V, T, S, P)$ be the phrase-structure grammar with $V=\{0,1, A, B, S\}, T=\{0,1\},$ and set of productions $P$ consisting of $S \rightarrow 0 A, S \rightarrow 1 A, A \rightarrow 0 B, B \rightarrow 1 A,$ $B \rightarrow 1$. a) Show that 10101 belongs to the language generated by $G$ . b) Show that 10110 does not belong to the language generated by $G .$ c) What is the language generated by $G ?$
Modeling Computation
Languages and Grammars
Let $G=(V, T, S, P)$ be the phrase-structure grammar with $V=\{0,1, A, S\}, T=\{0,1\},$ and set of productions $P$ consisting of $S \rightarrow 1 S, \quad S \rightarrow 00 A, \quad A \rightarrow 0 A$ and $A \rightarrow 0$ a) Show that 111000 belongs to the language generated by $G .$ b) Show that 11001 does not belong to the language generated by $G .$ c) What is the language generated by $G ?$
Let M be the language over {a, b, c, d, e, f} accepting all strings so that: 1. There are precisely two e's in the string. 2. Every a is immediately followed by an odd number of b's. 3. Every d is immediately followed by an even number of f's. 4. b's and f's don't occur except as provided in rules 2 and 3. 5. All a's occur after the first e. 6. All d's occur before the second e. 7. In between the two e's there are exactly twice as many a's as d's. Construct a context-free grammar generating M. You do not need an inductive proof, but you should explain how your construction accounts for each rule.
Akash M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Transcript
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD