Question: Hi Friends, Could someone help me by sharing solution for below assignment Assignment 3: Syntax-Based Translation The grammar below generates nested lists of numbers. The
Hi Friends, Could someone help me by sharing solution for below assignment
Assignment 3: Syntax-Based Translation
The grammar below generates nested lists of numbers. The semantic actions are intended to count the number of elements just inside each parenthesized list. For each list found by Rule 2, Marker 44 prints out the number of elements found just inside the list. For example, the input ( ( 1 2 3 ) ( 1 2 3 4 5 6 ) ) Should print 3, 6, and 2.
(a) The grammar uses a global variable count to determine the number of elements in a list. What is wrong with that approach? (b) Change the semantic actions so that the appropriate values are synthesized by the rules to allow counting without a global variable.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
