For this project you need to assmple the skeleton we will use for tipc this semester. These requirements use MUST, SHOULD, MAY, and their negations in accordance with RFC 2119. Your program MUST read in triples of integers, all between 0 and 1023, from a file specified on the command line. You MAY ensure the integers are in range, but do not have to. You MUST add functionality to calculate if any of the three integers in each triple are the sum or product of the other, and store that in the representation.
The program supports three outputs. The table printer will print the stored sequence of lines out as a list of comments. The pretty printer prints the triples back out with additional comments on the relation between the triples. The summary output prints a summary of how often each number occurs.
You SHOULD read through internalRep.h to understand how relations and lines are represented in the program, as well as the provided functions in that program.
You SHOULD skim through compilerUtils.h to understand the built-in functions provided for you.
You MAY skim through compilerUtils.cpp or internalRep.cpp to better understand of the implementation of te built-in functions.
You SHOULD use the built-in functions instead of reimplementing them.
You MAY modify any of the built-in functions freely.
You MUST complete the functions in internalrep.cpp underneath the //Project 0 comment. These include:
int read(ifstream &) - which currently only read a single digit. It MUST be able to read integers of arbitrary length. It MUST read from the stream a single character at a time, and MUST NOT use scanf, atoi, or other built-in methods for converting strings to integers. It SHOULD NOT worry about max_int or overflow.
Line readLine(ifstream&, bool&) - which currently leave the rel field of the line in an invalid state. It MUST initialize rel to the correct category and index. If any of the numbers in the line are the sum or product of the other two, it MUST note that in the relation category and index. If there are two possibly relations (i.e. 7 7 1), it SHOULD prefer the relation with the smaller index.
vector<line> readFile(&input, &summary) - which currently does not update the summary. It MUST update the summary to count the number of times every integer occurs in the file, regardless of index.
You MUST complete the functionality in main.cpp. This includes:
Finishing void execute(char*, options&) so that it produces the appropriate output for the flags.
The -p flag MUST invoke the pretty-printer on each line to pretty-print the output, with additional comments included to describe the relations.
The -t flag MUST invoke the table-printer on each line, to print the internal representation of the data.
You MUST print all outputs if multiple flags are passed in.
You MAY print the outputs in any order.
You MUST add an additional flag to support summary outputs. This will require modifying more than execute.
The -s flag MUST invoke the summary-printer to print a description of non-zero values in the summary.
Your program, including your Makefile, MUST work on the janus linux machines.
You SHOULD use the debug function for any debug outputs that you add to your program.
You MUST ensure that any output line that is not one of the triples of numbers is printed as a comment, prefixed by //.
You MUST print each triple and the sequence of triples in the same order as the input file.
This project is worth comparatively few points, and will be graded as follows:
Implements all MUST requirements: 16pts
Implements all SHOULD requirements: 2pts
Properly extending getopt to manage flags: 1 pt.
-h prints a complete and well-formatted message: 1 pt