Question: Binary Arithmetic Expression Trees Basic Part ( 1 0 0 points ) Problem Description This project is about design and implement expression trees, which are

Binary Arithmetic Expression Trees
Basic Part (100 points)
Problem Description
This project is about design and implement expression trees, which are special cases of parse
trees or grammar trees. you need to implement a program to do the following:
a) Takes a binary arithmetic expression as input, builds a binary expression tree for the
input expression
b) Check whether there are any syntactic or semantic errors in the expression. If yes, then
report the errors.
c) If there are no errors in the input expression, then
Calculate and display the value of the input expression.
Print the infix (in-order traversal), prefix (pre-order traversal) and postfix (post-
order traversal) expressions of the input expression.
For ease of your implementation and testing, your program shall input arithmetic expressions
from a text file. To help build the binary expression tree, you shall use two stack type data
structures, one helps manage operators from the arithmetic expression, and the other help
manage the tree nodes for building the trees.
The table below lists operation precedence and association orders.
Use the following input arithmetic expressions to test your program:
10.24+5.4*2.56.7+(12.5*20.67+10)*25
10.24+5.4*2.56.7+(12.5*20.67+10)*25
10.24+5.4*2.56.7+(12.5*20.67+)*25
Note:
Expression 1 has no syntactic errors.
Expressions 2 and 3 have one error each.
Binary Arithmetic Expression Trees Basic Part ( 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!