summaryrefslogtreecommitdiff
path: root/yy/main.c
blob: d53a598c2dc195c86a4f65f422a51e327d47c8a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include "kalmia.h"

int main(int argc, char **argv)
{
	if (argc < 2) {
		fprintf(stderr, "You must specify a file to parse!\n");
		return -1;
	}
	FILE *in = fopen(argv[1], "r");
	if (in == NULL) {
		fprintf(stderr, "Could not open file \"%s\"\n", argv[1]);
		return -1;
	}

	yyscan_t scanner;
	yylex_init(&scanner);
	yyset_in(in, scanner);
	yyparse(scanner);
	yylex_destroy(scanner);
	return 0;
}