[project @ 1996-01-11 14:06:51 by partain]
[ghc-hetmet.git] / ghc / compiler / yaccParser / 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     all = mklnil();             /* This should be the list of all derivable types */
27
28     process_args(argc,argv);
29
30     hash_init();
31
32 #ifdef HSP_DEBUG
33     fprintf(stderr,"input_file_dir=%s\n",input_file_dir);
34 #endif
35
36     yyinit();
37
38     if(yyparse() == 0 && !etags)
39       {
40         /* No syntax errors. */
41         pprogram(root);
42         printf("\n");
43         exit(0);
44       } 
45     else if(etags)
46       {
47         exit(0);
48       }
49     else
50       {
51         /* There was a syntax error. */
52         printf("\n");
53         exit(1);
54       }
55 }