1 /**********************************************************************
7 **********************************************************************/
10 #include "constants.h"
13 #define PARSER_VERSION "1.3-???"
15 tree root; /* The root of the built syntax tree. */
18 BOOLEAN nonstandardFlag = FALSE; /* Set if non-std Haskell extensions to be used. */
19 BOOLEAN acceptPrim = FALSE; /* Set if Int#, etc., may be used */
20 BOOLEAN haskell1_2Flag = FALSE; /* Set if we are compiling for 1.2 */
21 BOOLEAN etags = FALSE; /* Set if we're parsing only to produce tags. */
22 BOOLEAN hashIds = FALSE; /* Set if Identifiers should be hashed. */
24 BOOLEAN ignoreSCC = TRUE; /* Set if we ignore/filter scc expressions. */
26 static BOOLEAN verbose = FALSE; /* Set for verbose messages. */
29 static void who_am_i PROTO((void));
31 /**********************************************************************
37 **********************************************************************/
40 # include "constants.h"
45 process_args(argc,argv)
49 BOOLEAN keep_munging_option = FALSE;
53 while (argc > 0 && argv[0][0] == '-') {
55 keep_munging_option = TRUE;
57 while (keep_munging_option && *++*argv != '\0') {
61 who_am_i(); /* identify myself */
66 nonstandardFlag = TRUE;
71 haskell1_2Flag = TRUE;
86 /* -Hn -- Use Hash Table, Size n (if given) */
90 hash_table_size = atoi(*argv+1);
100 if(argc >= 1 && freopen(argv[0], "r", stdin) == NULL) {
101 fprintf(stderr, "Cannot open %s.\n", argv[0]);
105 if(argc >= 2 && freopen(argv[1], "w", stdout) == NULL) {
106 fprintf(stderr, "Cannot open %s.\n", argv[1]);
111 fprintf(stderr,"Hash Table Contains %d entries\n",hash_table_size);
113 fprintf(stderr,"Allowing special syntax for Unboxed Values\n");
121 fprintf(stderr, "PARSER: Error %s\n", s);
128 fprintf(stderr,"Glasgow Haskell parser, version %s\n", PARSER_VERSION);
138 if (tlist(l1) == lnil)
140 for(t = l1; tlist(ltl(t)) != lnil; t = ltl(t))
147 lapp(list l1, VOID_STAR l2)
151 if (tlist(l1) == lnil)
152 return(mklcons(l2, mklnil()));
153 for(t = l1; tlist(ltl(t)) != lnil; t = ltl(t))
155 ltl(t) = mklcons(l2, mklnil());