

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The requirements and specifications for csce 2050 programming assignment 5, due in fall 2006. Students are tasked with creating a program that processes a sequence of arithmetic statements, including variables, integers, parentheses, and arithmetic operators. The program must maintain stacks, a symbol table, and trees, and handle errors related to unbalanced parentheses, missing left variables, and unassigned symbols. The goal is to evaluate each statement using postfix notation and print the values of each variable at the end.
Typology: Assignments
1 / 2
This page cannot be seen from the preview
Don't miss anything!


Requirements [Lists, Stacks, Symbol Table, and Trees.] The difference between this assignment and the last is in the specifications section. Read from the input stream a sequence of (infix) arithmetic statements composed of
A semicolon will be used to denote the end of each statement. Statements will be in the form of assignment statements, that is, a variable (the left variable) followed by ā=ā followed by an arithmetic expression. Translate the statement to an internal code, then evaluate the statement using the postfix. The evaluation of a subexpression consisting in part of a left variable will be to update the value of the left variable in the symbol table. When the end of the list of statements is encountered (i.e., a statement consisting only of a semi-colon) print the values of each variable used in the the sequence of statements.
Specifications The input should appear as follows:
Please enter a sequence of arithmetic statements a = 2; b = 4^a - 6; c = 3*a + b; ;
The output should appear as follows:
Variable Value a 2 b 10 c 16
The symbols must appear in alphabetical order in the output list. Please note also the following issues that your code must take into account.
A C + + class must be used to maintain stacks. Appropriate member operators must be provided so the stacks can be manipulated. It is recommended but not required that yet another class be used to maintain lists. You may use the standard library functions if you prefer. There must be a symbol table class! The symbol table class must be organized as a binary search tree. You must have a method that executes an in-order traversal. This method is used to print the contents of the symbol table in alphabetical order.
Design and Testing No specific test case is prescribed. Run more than one test case. Your test cases must include checking for all the errors (balanced parentheses, etc.) noted in the list above.
Error Handling Error checking must at least include assuring the next input symbol is a legitimate token, that the parentheses of the expression are in balance, that the symbols used on the right of = have been assigned values, and that there is a left variable.
Implementation Due Date Friday, 8 December. Submit the following using the project command. Select the correct section of the class, 2050s001. The project id is phw4.