(10 points) 3.4 Consider the following parse tree: 1 / \ 2 3 / \ / \ 4 5 6 7 \ / 8 9 (4 points) a. List all phrases of this parse tree; (2 points) b. List all simple phrases of this parse tree; (4 points) c. List all handles in the order that they will be reduced from the tree by a bottom-up parser.
Added by Shawn S.
Close
Step 1
List all phrases of this parse tree: - 1 - 2 - 3 - 1 45 - 1 1 8 - 9 b. List all simple phrases of this parse tree: - 1 Show more…
Show all steps
Your feedback will help us improve your experience
Gio Maya and 70 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
Use top-down parsing to determine whether each of the following strings belongs to the language generated by the grammar in Example $12 .$ $$ \begin{array}{ll}{\text { a) } b a b a} & {\text { b) } a b a b} \\ {\text { c) } c b a b a} & {\text { d) } b b b c b a}\end{array} $$
Modeling Computation
Languages and Grammars
10) What is the value of this prefix expression when read as an infix expression? Draw the ordered rooted tree corresponding to the below arithmetic expressions written in prefix notation. a) x / 9 3 + x 2 4 - 7 6 b) - x 2 / 8 4 3 c) 5 2 1 - - 3 1 4 + + x d) 9 3 / 5 + 7 2 - x
Sri K.
(10 points) The following is a BNF description of the C/C++ pointer and array declarations: <Declaration> -> <Type> <Declarator>; <Type> -> int | char <Declarator> -> * <Declarator> | <Declarator> [ number ] | name Prove that this grammar is ambiguous. Hint: Find a sentence that can be generated using two different parse trees. Write down the sentence and then draw the two trees that generate this sentence.
Akash M.
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