[project @ 1996-03-19 08:58:34 by partain]
[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
31 #ifdef HSP_DEBUG
32     fprintf(stderr,"input_file_dir=%s\n",input_file_dir);
33 #endif
34
35     yyinit();
36
37     if(yyparse() == 0 && !etags)
38       {
39         /* No syntax errors. */
40         pprogram(root);
41         printf("\n");
42         exit(0);
43       } 
44     else if(etags)
45       {
46         exit(0);
47       }
48     else
49       {
50         /* There was a syntax error. */
51         printf("\n");
52         exit(1);
53       }
54 }