This commit is contained in:
2017-09-03 22:57:21 +02:00
commit 52186de3a7
6 changed files with 71 additions and 0 deletions

34
main.c Normal file
View File

@@ -0,0 +1,34 @@
#include <stdio.h>
#include "src/parser.h"
int main(int argc, char** argv) {
char* inp;
long size;
if (argc != 2) {
printf("usage: %s FILE\n", argv[0]);
return 1;
}
FILE* f = fopen(argv[1], "r");
if (!f) {
puts("Error while opening the file.");
return 1;
}
fseek(f, 0, SEEK_END);
size = ftell(f);
fseek(f, 0, SEEK_SET);
inp = malloc(size+1);
fread(inp, size, 1, f);
fclose(f);
inp[size] = '\0';
printf("%p\n", (void*) parse(inp));
return 0;
}