[project @ 1997-03-14 07:52:06 by simonpj]
[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     argv++; argc--;
28     process_args(argc,argv);
29
30     hash_init();
31     yyinit();
32
33     if(yyparse() == 0 && !etags)
34       {
35         /* No syntax errors. */
36         pprogram(root);
37         printf("\n");
38         exit(0);
39       } 
40     else if(etags)
41       {
42         exit(0);
43       }
44     else
45       {
46         /* There was a syntax error. */
47         printf("\n");
48         exit(1);
49       }
50 }