main.c,reader.c,calculator.cand their corresponding header files.- A Makefile
- Some testcases in the
testcasesfolder - a reference executable called
mini_ci_reference
The given code reads in a string representing a postfix operation, evaluates the value of the operation,
and prints the result, notifying the user if the operation was invalid.
A postfix operation is defined by <operand1> <operand2> <binary operator> eg. 1 2 + which evaluates to 3.
These operations can be chained together 8 1 - 2 + = 7 2 + = 9;
Similarly 8 1 2 - + = 8 -1 + = 7
If at any point the Reader encounters an error, the final result should be set to -1 and the Reader's had_error field
should be set to true. If no error occurs, the Reader's had_error field should be false.
The given program uses a greedy stack based approach to evaluate valid operations as soon as they appear.
Unfortunately, this program may be wrong!
- ssh into your favorite UTCS lab machine
- create a file
~/.gdbinit - Add the line
set history save onto~/.gdbinit - git clone this repository
- read then use the Makefile
- debug the test cases using GDB
- Ensure your output matches the reference exactly.
- Create a log file and inclue your shell logs and gdb logs
- commit and push your changes
- use git log and show proctor
- delete your local copy of this repository (you will need to use the r and f flags)
To run an individual testcase use
mini_ci <file>. Use mini_ci_reference <file> for the reference output.