325c553940bd8733cade5c1dcf41ebbd7deb9176
[ghc-hetmet.git] / ghc / compiler / parser / main.c
1 /* This is the "top-level" file for the *standalone* hsp parser.
2    See also hsclink.c.  (WDP 94/10)
3 */
4
5 #include <stdio.h>
6
7 #include "hspincl.h"
8 #include "constants.h"
9 #include "utils.h"
10
11 /*OLD:static char *progname;*/          /* The name of the program.              */
12
13
14 /**********************************************************************
15 *                                                                     *
16 *                                                                     *
17 *     The main program                                                *
18 *                                                                     *
19 *                                                                     *
20 **********************************************************************/
21
22 int
23 main(int argc, char **argv)
24 {
25     Lnil = mklnil();    /* The null list -- used in lsing, etc. */
26
27     process_args(argc,argv);
28
29     hash_init();
30     yyinit();
31
32     if(yyparse() == 0 && !etags)
33       {
34         /* No syntax errors. */
35         pprogram(root);
36         printf("\n");
37         exit(0);
38       } 
39     else if(etags)
40       {
41         exit(0);
42       }
43     else
44       {
45         /* There was a syntax error. */
46         printf("\n");
47         exit(1);
48       }
49 }