Question 2 Top Bottom Parsers Build Syntax Trees Different Orders Write Pair Programs Topd Q43782652
Question#2 a) Top-down and bottom-up parsers build syntax trees in different orders. Write a pair of programs, TopDown and BottomUp, that take a syntax tree and print out the nodes in order of construction. TopDown should display the order for a top-down parser, while BottomUp should show the order for a bottom-up parser. b) Consider the following grammar: Start + S S → Aa BC LBCf 1 1 1 a. Construct the canonical collection of sets of LR(I) items for this grammar. b. Derive the action and Go to tables. c. Is the grammar LR(1)? Show transcribed image text Question#2 a) Top-down and bottom-up parsers build syntax trees in different orders. Write a pair of programs, TopDown and BottomUp, that take a syntax tree and print out the nodes in order of construction. TopDown should display the order for a top-down parser, while BottomUp should show the order for a bottom-up parser. b) Consider the following grammar: Start + S S → Aa BC LBCf 1 1 1 a. Construct the canonical collection of sets of LR(I) items for this grammar. b. Derive the action and Go to tables. c. Is the grammar LR(1)?
Expert Answer
Answer to Question#2 a) Top-down and bottom-up parsers build syntax trees in different orders. Write a pair of programs, TopDown a…
OR