blob: 0d97fba79a282f017e61fb3096c843949b43c5bc (
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 <stdio.h>
#define YYLTYPE KALMIALTYPE
#define YYSTYPE KALMIASTYPE
#include "kalmia.tab.h"
#include "kalmia.lex.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;
}
struct kalmia_t result;
yyscan_t scanner;
kalmialex_init(&scanner);
kalmiaset_in(in, scanner);
kalmiaparse(scanner, &result);
kalmialex_destroy(scanner);
return 0;
}
|