Question: Please help 5. Backus Naur Form (BNF), and Expression Trees. Consider the following BNF definition of arithmetic expressions: expression ::= term + expression | term

5. Backus Naur Form (BNF), and Expression Trees. Consider the following BNF definition of arithmetic expressions: expression ::= term + expression | term expression | term term ::= factor * term | factor / term | factor factor ::= literal | (expression ) literal ::=0|1|2|3|4|5|6|7|8|9 a. Build the expression tree of: 8/4-9/3-3. b. Build the expression tree of: 896/3. c. Write an expression that corresponds to the following expression tree: 8 9 d. Write function evaluate () that takes an expression tree and returns its value. e. Show the trace of execution of this tree on the tree given in question (c)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
