#include "../includes/include.h" node_info *create_logic(int opperation, int expr, node_info *statement_list, node_info *else_false) { node_info *n = malloc(sizeof(node_info)); switch (opperation) { //if statement case 1: //logical expression, see node_info for opperation info n->opperation = 4; logic a; a.opperation = 1; a.expr = expr; while (statement_list->statement_list != NULL) { statement_list = statement_list->statement_list; } //now that we have the statement list, we need to make the head opperation 5 node_info *newNode = malloc(sizeof(node_info)); newNode->opperation = 5; newNode->next = copy_linked_list(statement_list); _free_linked_list(statement_list); a.if_true = newNode; //this removes the last statement list in statementHead statement_list = NULL; n->logicalExpression = a; return n; break; //while loop case 2: /*n->opperation = 4; logic b; b.opperation = 2; b.expr = expr; b.while_true = if_true; n->logicalExpression = b; return n;*/ break; default: printf("check your yacc file for logical statements\n"); } }