blob: 2d358d860d6a137af6ab084153dd7a2d694af2e9 (
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
34
35
36
37
38
|
#include <stdio.h>
#include "ast.h"
#include "lexer.h"
extern struct Node* program_root;
int yyparse(void);
static int parse_program(void)
{
int status = yyparse();
if (status != 0 || lexer_failed())
status = 1;
node_free(program_root);
program_root = NULL;
return status;
}
int main(int argc, char** argv)
{
if (argc != 2)
{
(void)fprintf(stderr, "usage: sfinae <file.sfinae>\n");
return 2;
}
yyin = fopen(argv[1], "r");
if (yyin == NULL)
{
(void)fprintf(stderr, "cannot open %s\n", argv[1]);
return 1;
}
int status = parse_program();
(void)fclose(yyin);
return status;
}
|