use cstr use vector # split_into_lines modifies the original text (changes \n to \0) split_into_lines(str text, vector *lines) str newline repeat newline = strchr(text, "\n") if newline == NULL break *(str*)vector_push(lines) = text *newline = '\0' text = newline + 1 if strlen(text) != 0 error("text does not end with a newline") collect_block(vector lines, vector statements) vector _statement, *statement = &_statement vector_init(&statement)