[project @ 1996-01-08 20:28:12 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(argc, argv)
24   int argc;
25   char **argv;
26 {
27     Lnil = mklnil();    /* The null list -- used in lsing, etc. */
28     all = mklnil();             /* This should be the list of all derivable types */
29
30     process_args(argc,argv);
31
32     hash_init();
33
34 #ifdef HSP_DEBUG
35     fprintf(stderr,"input_file_dir=%s\n",input_file_dir);
36 #endif
37
38     yyinit();
39
40     if(yyparse() == 0 && !etags)
41       {
42         /* No syntax errors. */
43         pprogram(root);
44         printf("\n");
45         exit(0);
46       } 
47     else if(etags)
48       {
49         exit(0);
50       }
51     else
52       {
53         /* There was a syntax error. */
54         printf("\n");
55         exit(1);
56       }
57 }