-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.c
49 lines (39 loc) · 1.08 KB
/
main.c
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
39
40
41
42
43
44
45
46
47
48
49
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "defs.h"
#include "types.h"
#include "symtab.h"
#include "bucket.h"
#include "tree.h"
FILE *errfp; /* file to which message.c will write */
/* For debugging purposes only */
#ifdef YYDEBUG
extern int yydebug;
#endif
int main(int argc, char *argv[])
{
int status, yyparse();
BOOLEAN dump_flag = FALSE;
if (argc==2 && (!strcmp(argv[1], "-d") || !strcmp(argv[1], "--dump")))
dump_flag = TRUE;
else if (argc > 1) {
fprintf(stderr, "%s: bad command line argument(s)\n", argv[0]);
exit(1);
}
errfp = stderr;
ty_types_init();
st_init_symtab();
init_bucket_module();
if (dump_flag) {
st_establish_data_dump_func(stdr_dump);
st_establish_tdata_dump_func(stdr_dump);
}
#ifdef YYDEBUG
yydebug = 1; /* DEBUG */
#endif
status = yyparse(); /* Parse and translate the source */
if (status==0 && dump_flag) /* If parse was successful */
st_dump(); /* Dump the symbol table */
return status;
}