Rule *parse_file(FILE *fp) {
    // Create a pointer to the first rule in the linked list.
    Rule *first_rule = create_rule(fp, NULL);

    // Create new rules while the file is not empty.
    Rule *prev_rule = first_rule;
    Rule *new_rule;
    while (new_rule != NULL) {
        // Attempt to create a new rule from current position in Makefile.
        new_rule = create_rule(fp, first_rule);

        // Link the newly created rule to the previous rule if successful.
        if (new_rule != NULL) {
            prev_rule->next_rule = create_rule(fp, first_rule);
            prev_rule = prev_rule->next_rule;
        }
    }

    // Return a pointer to the first rule in the linked list.
    return first_rule;
}
/* Read from the open file fp, and create the linked data structure
   that represents the Makefile contained in the file.
   See the top of pmake.h for the specification of Makefile contents.
 */