summaryrefslogtreecommitdiff
path: root/cc.c
blob: 0a38f0e0ad9062baa800345a6c9bf1054b11f158 (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
27
28
29
30
31
32
33
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "lex.h"
#include "parse.h"
#include "types.h"

int main() {
	FILE *f = fopen("test.c", "r");

	lexobj lexes[4096];
	int lexcount = 0;

	char *line = malloc(256);
	while (fgets(line, 256, f) != NULL) {
		stripwhitespace(line);
		while (line[0] != 0) {
			lexes[lexcount] = lex(line);
			lexcount++;
			line = saveptr;
		}
		char *line = malloc(256);
	}

	ast exprs[4096];
	int exprcount;

	while (lexcount > 0) {
		exprs[exprcount] = genast(lexes, &lexcount);
		exprcount++;
	}
}