1 char rcsid_main
[] = "$Id$";
9 static int simpleTables
= 0;
10 static int internals
= 0;
11 static int diagnostics
= 0;
13 static char *inFileName
;
14 static char *outFileName
;
16 static char version
[] = "BURG, Version 1.0";
18 extern int main
ARGS((int argc
, char **argv
));
21 main(argc
, argv
) int argc
; char **argv
;
24 extern int atoi
ARGS((const char *));
26 for (i
= 1; argv
[i
]; i
++) {
30 if (argv
[i
][0] == '-') {
33 fprintf(stderr
, "%s\n", version
);
36 needStr
= (char**)&prefix
;
39 needStr
= &outFileName
;
49 fprintf(stderr
, "'%s' was not compiled to support lexicographic ordering\n", argv
[0]);
55 needInt
= &principleCost
;
58 needInt
= &prevent_divergence
;
61 needInt
= &exceptionTolerance
;
76 fprintf(stderr
, "Bad option (%s)\n", argv
[i
]);
81 fprintf(stderr
, "Unexpected Filename (%s) after (%s)\n", argv
[i
], inFileName
);
86 if (needInt
|| needStr
) {
95 fprintf(stderr
, "Expection argument after %s\n", opt
);
101 } else if (needStr
) {
108 if(freopen(inFileName
, "r", stdin
)==NULL
) {
109 fprintf(stderr
, "Failed opening (%s)", inFileName
);
115 if ((outfile
= fopen(outFileName
, "w")) == NULL
) {
116 fprintf(stderr
, "Failed opening (%s)", outFileName
);
127 fprintf(stderr
, "ERROR: No rules present\n");
136 debug(debugTables
, foreachList((ListFn
) dumpOperator_l
, operators
));
137 debug(debugTables
, printf("---final set of states ---\n"));
138 debug(debugTables
, dumpMapping(globalMap
));
160 makeOperatorVector();
167 makeDeltaCostArray();
168 makeStateStringArray();
169 makeNonterminalArray();