Assume that the alphabet Σ = { a, b }. Consider the following ambiguous grammar for arithmetic expressions. Draw two different derivation trees for the string w = b*(b+a*b)+a E --> E + E E --> E * E E --> ( E ) E --> a E --> b
Added by Sara J.
Step 1
First, we need to identify the different parts of the string w and determine which rules to apply to each part. w = b*(b+a*b)+a - The first part is b*, which means zero or more occurrences of b. This can be derived using the rule E --> b*. - The second part is Show more…
Show all steps
Your feedback will help us improve your experience
Harriet O'Brien and 91 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 $\Sigma$ denote the English alphabet. Let $f : \Sigma^{*} \times \Sigma^{*} \rightarrow \Sigma^{*}$ defined by $f(x, y)=$ $x y,$ the concatenation of $x$ and $y .$ Find $f(x, y)$ for each pair of words $x$ and $y .$ net, work
Functions and Matrices
The Concept of a Function
Let $G$ be the grammar with $V=\{a, b, c, S\} ; T=$ $\{a, b, c\} ;$ starting symbol $S ;$ and productions $S \rightarrow$ $a b S, S \rightarrow b c S, S \rightarrow b b S, S \rightarrow a,$ and $S \rightarrow c b .$ Construct derivation trees for $$ \begin{array}{l}{\text { a) bcbba. } \quad \text { b) bbbcbba. }} \\ {\text { c) } b c a b b b b b c b \text { . }}\end{array} $$
Modeling Computation
Languages and Grammars
Let $\Sigma$ denote the English alphabet. Let $f : \Sigma^{*} \times \Sigma^{*} \rightarrow \Sigma^{*}$ defined by $f(x, y)=$ $x y,$ the concatenation of $x$ and $y .$ Find $f(x, y)$ for each pair of words $x$ and $y .$ combi, natorics
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
Watch the video solution with this free unlock.
EMAIL
PASSWORD