+ fseek(file, 0, SEEK_END);
+ fsize = ftell(file);
+ fseek(file, 0, SEEK_SET);
+
+ output = malloc(fsize+1); // maybe error check malloc
+ fread(output, 1, fsize, file);
+ if (ferror(file)) {
+ printf("Something went wrong reading file\n");
+ fclose(file);
+ free(output);
+ return NULL;
+ }
+ output[fsize] = 0; // add null terminator
+
+ /* clean up */
+ fclose(file);
+
+ /* return */
+ *size = fsize;
+ return output;
+}
+
+Board*
+begin_parse(char* board_path)
+{
+ const char* input_buffer;
+ long input_size;
+ State state;
+ Board* new_board;
+
+ /* read entire file */
+ input_buffer = read_file(board_path, &input_size);
+
+ /* setup state */
+ state.cur_todolist = NULL;
+ state.cur_todoitem = NULL;
+
+ new_board = malloc(sizeof(Board));
+ new_board->todolist_list = malloc(0);
+ new_board->todolist_count = 0;
+ state.board = new_board;
+
+ md_parse(input_buffer, input_size, &parser, &state);
+
+ /* finish calls */
+ exit_todolist(&state);
+
+ free((char*)input_buffer);
+
+ return state.board;
+}
+
+void
+enter_todolist(State* state, char* list_name)
+{
+ TodoList* new_todolist;
+
+ new_todolist = malloc(sizeof(TodoList));
+ new_todolist->list_name = list_name;
+ new_todolist->item_list = malloc(0);
+ new_todolist->item_count = 0;
+
+ state->cur_todolist = new_todolist;
+}
+
+void
+exit_todolist(State* state)
+{
+ #define sb state->board
+
+ if (state->cur_todolist == NULL) return;
+
+ exit_todoitem(state);
+
+ sb->todolist_count += 1;
+ sb->todolist_list = realloc(sb->todolist_list, sb->todolist_count*sizeof(TodoList*));
+ sb->todolist_list[sb->todolist_count-1] = state->cur_todolist;
+ state->cur_todolist = NULL;
+
+}
+
+void
+enter_todoitem(State* state, char* item_name)
+{
+ TodoItem* new_todoitem;
+
+ new_todoitem = malloc(sizeof(TodoItem));
+ new_todoitem->item_name = item_name;
+ new_todoitem->description = NULL;
+ new_todoitem->due = NULL;
+ new_todoitem->subtask_list = malloc(0);
+ new_todoitem->subtask_count = 0;