Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!think!mintaka!snorkelwacker!spdcc!ima!esegue!compilers-sender From: corbett@ernie.Berkeley.EDU (Robert Corbett) Newsgroups: comp.compilers Subject: Berkeley Yacc (bug fixes) Message-ID: <1989Dec7.145118.280@esegue.segue.boston.ma.us> Date: 7 Dec 89 14:51:18 GMT Sender: compilers-sender@esegue.segue.boston.ma.us Reply-To: corbett@ernie.Berkeley.EDU (Robert Corbett) Organization: University of California, Berkeley Lines: 206 Approved: compilers@esegue.segue.boston.ma.us I have fixed several bugs in the new version of Berkeley Yacc. The copy of the source in ucbarpa:~ftp/pub/byacc.tar.Z has been updated. For those who already have copies of the new version, a copy of the diffs appears at the end of this note. Special thanks to Dave Gentzel and Bill Sommerfeld for pointing out numerous bugs. Yours truly, Bob Corbett diff ./closure.c ../zoo1/closure.c 104,105c104,105 < closure(nucleus, n) < short *nucleus; --- > closure(core, n) > short *core; 127,128c127,128 < csend = nucleus + n; < for (csp = nucleus; csp < csend; ++csp) --- > csend = core + n; > for (csp = core; csp < csend; ++csp) 142c142 < csp = nucleus; --- > csp = core; diff ./defs.h ../zoo1/defs.h 241d240 < extern bucket *last_symbol; diff ./error.c ../zoo1/error.c 73c73 < done(1); --- > exit(1); diff ./main.c ../zoo1/main.c 63,65c63,65 < if (action_file) { fclose(action_file); unlink(action_file_name); } < if (text_file) { fclose(text_file); unlink(text_file_name); } < if (union_file) { fclose(union_file); unlink(union_file_name); } --- > if (action_file) unlink(action_file_name); > if (text_file) unlink(text_file_name); > if (union_file) unlink(union_file_name); 196,199c196,205 < len = strlen(tmpdir); < i = len + 13; < if (len && tmpdir[len-1] != '/') < ++i; --- > if (*tmpdir) > { > len = 0; > while (tmpdir[len]) ++len; > i = len + 14 + (tmpdir[len - 1] == '/'); > } > else > { > i = 14; > } 212c218 < if (len && tmpdir[len - 1] != '/') --- > if (*tmpdir && tmpdir[len - 1] != '/') 297a304,305 > register int c; > diff ./mkpar.c ../zoo1/mkpar.c 286c286 < for (p = first; p != last; p = p->next, p->suppressed = 1) --- > for (p = first; p != last; p = p->next, p->suppressed) diff ./output.c ../zoo1/output.c 25,27d24 < output_defines(); < output_stored_text(); < output_yyconst(); 31a29,30 > output_defines(); > output_stored_text(); 42,49d40 < output_yyconst() < { < outline += 3; < fprintf(output_file, "#ifndef YYCONST\n#define YYCONST /* const */\n\ < #endif\n"); < } < < 56c47 < fprintf(output_file, "YYCONST short yylhs[] = {%42d,", --- > fprintf(output_file, "short yylhs[] = {%42d,", 76c67 < fprintf(output_file, "YYCONST short yylen[] = {%42d,", 2); --- > fprintf(output_file, "short yylen[] = {%42d,", 2); 101c92 < fprintf(output_file, "YYCONST short yydefred[] = {%39d,", --- > fprintf(output_file, "short yydefred[] = {%39d,", 243c234 < fprintf(output_file, "YYCONST short yydgoto[] = {%40d,", k); --- > fprintf(output_file, "short yydgoto[] = {%40d,", k); 519,524c510,512 < newmax = maxtable; < do { newmax += 200; } while (newmax <= loc); < table = (short *) realloc(table, newmax*sizeof(short)); < if (table == 0) no_space(); < check = (short *) realloc(check, newmax*sizeof(short)); < if (check == 0) no_space(); --- > do { newmax = maxtable + 200; } while (newmax <= loc); > table = (short *) realloc(table, newmax); > check = (short *) realloc(check, newmax); 565c553 < fprintf(output_file, "YYCONST short yysindex[] = {%39d,", base[0]); --- > fprintf(output_file, "short yysindex[] = {%39d,", base[0]); 583,584c571 < fprintf(output_file, "\n};\nYYCONST short yyrindex[] = {%39d,", < base[nstates]); --- > fprintf(output_file, "\n};\nshort yyrindex[] = {%39d,", base[nstates]); 602,603c589 < fprintf(output_file, "\n};\nYYCONST short yygindex[] = {%39d,", < base[2*nstates]); --- > fprintf(output_file, "\n};\nshort yygindex[] = {%39d,", base[2*nstates]); 634c620 < fprintf(output_file, "YYCONST short yytable[] = {%40d,", table[0]); --- > fprintf(output_file, "short yytable[] = {%40d,", table[0]); 663c649 < fprintf(output_file, "YYCONST short yycheck[] = {%40d,", check[0]); --- > fprintf(output_file, "short yycheck[] = {%40d,", check[0]); 772c758 < register int c; --- > register int c, last; 782,786d767 < if (!lflag) < { < ++outline; < fprintf(output_file, line_format, outline, output_file_name); < } 794a776,780 > if (!lflag) > { > ++outline; > fprintf(output_file, line_format, outline, output_file_name); > } 817c803 < fprintf(output_file, "#if YYDEBUG\nYYCONST char *yyname[] = {"); --- > fprintf(output_file, "#if YYDEBUG\nchar *yyname[] = {"); 950c936 < fprintf(output_file, "YYCONST char *yyrule[] = {\n"); --- > fprintf(output_file, "char *yyrule[] = {\n"); diff ./reader.c ../zoo1/reader.c 1114,1115d1113 < last_symbol->next = bp; < last_symbol = bp; 1403d1400 < { 1405,1406d1401 < /*NOTREACHED*/ < } diff ./verbose.c ../zoo1/verbose.c 112c112 < (accept, reduce %d) on $end\n", state, r->number - 2); --- > (accept, reduce %d) on $end\n", state, r->number); 126c126 < (shift %d, reduce %d) on %s\n", state, p->number, r->number - 2, --- > (shift %d, reduce %d) on %s\n", state, p->number, r->number, 138c138 < (reduce %d, reduce %d) on %s\n", state, p->number - 2, r->number - 2, --- > (reduce %d, reduce %d) on %s\n", state, p->number, r->number, 194,195c194 < if (p->action_code == REDUCE && < (p->suppressed == 0 || p->suppressed == 1)) --- > if (p->action_code == REDUCE && p->suppressed == 0) 200c199 < for (j = 0; j < nnulls && i > null_rules[j]; ++j) --- > for (j = 0; j < nnulls && i < null_rules[j]; ++j) 202d200 < 330c328 < for (i = 0; i < sp->nshifts; ++i) --- > for (i = sp->nshifts - 1; i >= 0; i--) 335a334,335 > else > break; -- Send compilers articles to compilers@esegue.segue.boston.ma.us {spdcc | ima | lotus}!esegue. Meta-mail to compilers-request@esegue. Please send responses to the author of the message, not the poster.