summaryrefslogtreecommitdiff
path: root/ghc/compiler/yaccParser/main.c
blob: 0c6e197b42cb24e1f93de977020935493bb3fbfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* This is the "top-level" file for the *standalone* hsp parser.
   See also hsclink.c.  (WDP 94/10)
*/

#include <stdio.h>

#include "hspincl.h"
#include "constants.h"
#include "utils.h"

/*OLD:static char *progname;*/		/* The name of the program.              */


/**********************************************************************
*                                                                     *
*                                                                     *
*     The main program                                                *
*                                                                     *
*                                                                     *
**********************************************************************/

int
main(argc, argv)
  int argc;
  char **argv;
{
    Lnil = mklnil();	/* The null list -- used in lsing, etc. */
    all = mklnil();		/* This should be the list of all derivable types */

    process_args(argc,argv);

    hash_init();

#ifdef HSP_DEBUG
    fprintf(stderr,"input_file_dir=%s\n",input_file_dir);
#endif

    yyinit();

    if(yyparse() == 0 && !etags)
      {
	/* No syntax errors. */
	pprogram(root);
	printf("\n");
	exit(0);
      } 
    else if(etags)
      {
	exit(0);
      }
    else
      {
	/* There was a syntax error. */
	printf("\n");
	exit(1);
      }
}