summaryrefslogtreecommitdiff
path: root/ghc/compiler/yaccParser/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'ghc/compiler/yaccParser/main.c')
-rw-r--r--ghc/compiler/yaccParser/main.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/ghc/compiler/yaccParser/main.c b/ghc/compiler/yaccParser/main.c
new file mode 100644
index 0000000000..0c6e197b42
--- /dev/null
+++ b/ghc/compiler/yaccParser/main.c
@@ -0,0 +1,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);
+ }
+}