COMP15 Fall 20XX
Due: Wednesday, November 10, 11:00PM
One of the chief advantages of the abstract datatype (ADT) approach is the encapsulation of design and implementation decisions within reusable modules. Through encapsulation, the developer has the freedom to change the implementation of an ADT without modifying either the interface to the ADT or the code that uses it.
The goal of this project is to reimplement the stack ADT using a linked list to store and manipulate items on the stack. You must reuse the testing code developed in Project #4 to test and validate your new implementation. You must also incorporate the new ADT implementation into the RPN expression evaluator developed in Project #5.
The objectives for this project are:
Only two files are provided, list_stack.h and eval_stack.h. Both files are available in the directory /g/15/class/project6. You must also reuse the evaluation stack class and testing code developed in Project #4 and the lexical analyzer and RPN expression evaluation code in Project #5.
You will need to reimplement the stack ADT using the files list_stack.h and list_stack.cpp. The new implementation must use a linked list to maintain the contents of the stack. Stack items should be allocated and deallocated dynamically. You will need to add private data members to list_stack.h to manage the linked list. You must provide a copy constructor for the new stack class that makes a complete copy of the stack when called.
The stack ADT implementation must allocate storage for each item when it's needed and deallocate storage for each item when the item is no longer needed. Your code should catch and handle exceptions thrown by new. The stack destructor should deallocate any dynamic storage when it is called to prevent memory leaks.
You should use your evaluation stack module and testing code from Project #4 to check out the new implementation. You must also test your new stack ADT using the RPN evaluator developed in Project #5. You may, of course, add new tests.
Here are some additional requirements to be satisfied:
Use the provide system to submit your finished program:
provide comp15 a6 makefile list_stack.h ...The files to be submitted are:
list_stack.h Declaration of stack interface list_stack.cpp Definition of stack eval_stack.h Declaration of evaluation stack interface eval_stack.cpp Definition of evaluation stack lexan.h Declaration of the lexical analysis interface lexan.cpp Implementation of the lexical analyzer eval_main.cpp RPN evaluation driver test_main.cpp Test driver makefile makefile to build everythingBe sure to build and test your program on comp15.cs.tufts.edu before submitting your work. This system is the target build and test platform for all course projects.
Here are two additional requirements for extra credit: