blob: 6518b4ad1d85232a0056b2b9ec3f0e5ef5b1607b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
#include <stdio.h>
#include <stdlib.h>
#include "lexer.h"
#include "parser.h"
int main(void)
{
FILE *fp = fopen("examples/hello_world.ll", "r");
fseek(fp, 0, SEEK_END);
size_t length = ftell(fp);
fseek(fp, 0, SEEK_SET);
char *src = malloc(length + 1);
fread(src, 1, length, fp);
src[length] = '\0';
token *head = lexer_parse(src);
if (!head) {
printf("Parsing error!\n");
exit(1);
}
ir_parse(head);
return 0;
}
|