take in a file, read it, tokenize each line and create new structures using helper fuctions without a segmentation error.
Rule *parse_file(FILE *fp) {
    Rule *rules = NULL;
    char line[MAXLINE];
    Rule *currParent = NULL;
    while(fgets(line, sizeof(line) - 1, fp) != NULL) {
        line[strlen(line)] = '\0';
        char *token;
        printf("%s\n", line);
        //handling #, so that line ignores everything after it
        if (strchr(line, '#') != NULL){
            char* remove = strchr(line, '#');
            *remove = '\0';
        }
        token = strtok(line, " \n");
        //skip lines with nothing or just a newline char
        if (token != NULL){
            printf("%s\n", token);
            char *newTarget = NULL;
            strcpy(newTarget, token);
            token = strtok(NULL, " \n");
            printf("%s\n", token);
            printf("HERE\n");
            //handling Target lines
            if (token == NULL){

            }
            else if (strchr(token, ':') != NULL) {
                printf("gotheretoo\n");
                //create initial rule
                Rule *parent = create_rule(rules, newTarget);
                printf("gotheretooAFTER\n");
                currParent = parent;
                printf("gotheretooAFTER\n");
                while (token != NULL){
                    printf("gotheretoo\n");
                    create_dependancy(rules, parent, token);
                    token = strtok(NULL, " \n");
                }
            }
            else {
                if (currParent == NULL){
                    printf("error: action line leading file without respective target line");
                    exit(1);
                }
                Action *actionCurr = currParent->actions;
                while (actionCurr != NULL){
                    actionCurr = actionCurr->next_act;
                }
                Action *newAction = malloc(sizeof(Action));
                newAction->next_act = NULL;
                newAction->args[0] = newTarget;
                int i = 0;
                while(token != NULL){
                    newAction->args[i] = token;
                    i += 1;
                    token = strtok(NULL, " ");
                }
                newAction->args[i] = NULL;
                actionCurr = newAction;
            }
            
        }
    }
    return rules;
}