summaryrefslogtreecommitdiff
path: root/igen/igen.c
blob: 921ca795a5515b9707a0b3717bced7e5469c5fd5 (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
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lexer.h"
#include "misc.h"
#include "preprocessor.h"

void usage(const char *name) {
	printf("Usage: %s <file>\n", name);
}

int main(int argc, char **argv) {
	int dbg = 0;
	int ret = 0;
	source *root_src;
	if (argc < 2) {
		usage(argv[0]);
		ret = 1;
	}
	root_src = preprocess(NULL, argv[1], dbg);
	if (root_src == NULL) {
		usage(argv[0]);
		ret = 1;
	} else {
		ret = lex(root_src, dbg);
	}
	return ret;
}