#include #include #include #include char * load_file(char *path) { FILE *file = fopen(path, "r"); if(file == NULL) { printf("Failed opening file at '%s'\n", path); return NULL; } fseek(file, 0, SEEK_END); long length = ftell(file); fseek(file, 0, SEEK_SET); char *content = malloc(length+1); content[length] = 0x00; fread(content, 1, length, file); fclose(file); return content; } int main(int argc, char **argv) { if(argc != 2) { printf("Usage: %s \n", argv[0]); return -1; } char *source = load_file(argv[1]); if(source == NULL) { puts("Stopping due to previous error!"); return -2; } pac_convert_grammar(source); return 0; }