#include "parser.h" #include "types.h" #include "lexer.h" #include GroundProgram createGroundProgram() { GroundProgram gp; gp.size = 0; return gp; } void addInstructionToProgram(GroundProgram* gp, GroundInstruction instruction) { gp->size++; GroundInstruction* ptr = realloc(gp->instructions, gp->size * sizeof(GroundInstruction)); if (ptr == NULL) { perror("Couldn't allocate memory for instruction"); exit(1); } gp->instructions = ptr; gp->instructions[gp->size - 1] = instruction; } void freeGroundProgram(GroundProgram* gp) { for (int i = 0; i < gp->size; i++) { freeGroundInstruction(&gp->instructions[i]); } } GroundProgram parseFile(LexedFile file) { GroundProgram gp; return gp; }