/* driver2.c * driver program for testing the PASC parser */ #include int outtree = 0; /* flag -- print out syntax tree or not? */ int trace = 0; /* flag -- print out trace info or not */ FILE *treelst; /* file used to same the syntax tree */ extern void init_table(); /* hash table initialization, imported from table.c */ main(argc, argv) int argc; char *argv[]; { /* check command line switchs */ argc--; argv++; while (argc > 0) { if (!strcmp(*argv, "-da")) { /* trace parser actions */ trace = 1; } else if (!strcmp(*argv, "-dt")) { /* print syntax tree */ outtree = 1; if (argc > 1) { if ((treelst = fopen(*++argv, "w")) == NULL) { printf("Can't open file '%s' for output. ", *argv); printf("Stdout is assumed\n\n"); treelst = stdout; } argc--; } else { printf("Output file not specified. Stdout is assumed\n\n"); treelst = stdout; } } argc--; argv++; } init_table(); /* initialize hash table */ if (!yyparse()) printf("Program accepted\n\n"); else printf("Program rejected\n\n"); }