-
Notifications
You must be signed in to change notification settings - Fork 4
/
byacc.1.9.patch.txt
575 lines (573 loc) · 17.1 KB
/
byacc.1.9.patch.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
diff -Naur byacc.1.9/COPYRIGHT byacc-1.9/COPYRIGHT
--- byacc.1.9/COPYRIGHT 1970-01-01 01:00:00.000000000 +0100
+++ byacc-1.9/COPYRIGHT 2006-07-03 12:13:56.000000000 +0200
@@ -0,0 +1,23 @@
+ Berkeley Yacc is an LALR(1) parser generator. Berkeley Yacc has been made
+as compatible as possible with AT&T Yacc. Berkeley Yacc can accept any input
+specification that conforms to the AT&T Yacc documentation. Specifications
+that take advantage of undocumented features of AT&T Yacc will probably be
+rejected.
+
+ Berkeley Yacc is distributed with no warranty whatever. The code is certain
+to contain errors. Neither the author nor any contributor takes responsibility
+for any consequences of its use.
+
+ Berkeley Yacc is in the public domain. The data structures and algorithms
+used in Berkeley Yacc are all either taken from documents available to the
+general public or are inventions of the author. Anyone may freely distribute
+source or binary forms of Berkeley Yacc whether unchanged or modified.
+Distributers may charge whatever fees they can obtain for Berkeley Yacc.
+Programs generated by Berkeley Yacc may be distributed freely.
+
+ Please report bugs to
+
+
+Include a small example if possible. Please include the banner string from
+skeleton.c with the bug report. Do not expect rapid responses.
diff -Naur byacc.1.9/CSU.diffs byacc-1.9/CSU.diffs
--- byacc.1.9/CSU.diffs 1970-01-01 01:00:00.000000000 +0100
+++ byacc-1.9/CSU.diffs 2006-07-03 12:13:56.000000000 +0200
@@ -0,0 +1,17 @@
+*** main.c.orig Mon Jul 5 18:47:51 1993
+--- main.c Mon Jul 5 19:18:46 1993
+***************
+*** 72,76 ****
+
+
+! onintr()
+ {
+ done(1);
+--- 72,78 ----
+
+
+! void
+! onintr(signo)
+! int signo;
+ {
+ done(1);
diff -Naur byacc.1.9/debian.control byacc-1.9/debian.control
--- byacc.1.9/debian.control 1970-01-01 01:00:00.000000000 +0100
+++ byacc-1.9/debian.control 2006-07-03 12:13:56.000000000 +0200
@@ -0,0 +1,5 @@
+PACKAGE: byacc
+VERSION: 1.9
+PACKAGE_REVISION: 2
+MAINTAINER: Peter Tobias <[email protected]>
+DESCRIPTION: The Berkeley LALR parser generator
diff -Naur byacc.1.9/debian.README byacc-1.9/debian.README
--- byacc.1.9/debian.README 1970-01-01 01:00:00.000000000 +0100
+++ byacc-1.9/debian.README 2006-07-03 12:13:56.000000000 +0200
@@ -0,0 +1,8 @@
+Last update: 08/10/94
+
+The following things have been changed for the Debian distribution:
+
+- changed the makefile (CFLAGS)
+
+
+Peter Tobias <[email protected]>
diff -Naur byacc.1.9/debian.rules byacc-1.9/debian.rules
--- byacc.1.9/debian.rules 1970-01-01 01:00:00.000000000 +0100
+++ byacc-1.9/debian.rules 2006-07-03 12:13:56.000000000 +0200
@@ -0,0 +1,49 @@
+#!/usr/bin/make -f
+
+.PHONY: build
+
+PKG = byacc-1.9
+
+P_REV := $(shell grep "PACKAGE_REVISION:" debian.control | cut -d' ' -f 2)
+
+
+build:
+ make "CFLAGS=-O2 -DNDEBUG" LDFLAGS=-s
+
+install: build
+ install -o root -g root -m 0755 yacc /usr/bin/byacc
+ install -o root -g root -m 0644 yacc.1 /usr/man/man1/byacc.1
+
+clean:
+ make clean
+ rm -f debian-tmp
+
+binary: build
+ install -o root -g root -m 0755 -d debian-tmp
+ install -o root -g root -m 0755 -d debian-tmp/DEBIAN
+ install -o root -g root -m 0755 -d debian-tmp/usr/bin
+ install -o root -g root -m 0755 -d debian-tmp/usr/man/man1
+ install -o root -g root -m 0755 -d debian-tmp/usr/doc/copyright
+ install -o root -g root -m 0755 yacc debian-tmp/usr/bin/byacc
+ install -o root -g root -m 0644 yacc.1 debian-tmp/usr/man/man1/byacc.1
+ install -o root -g root -m 0644 COPYRIGHT debian-tmp/usr/doc/copyright/byacc
+ install -o root -g root -m 0644 debian.control debian-tmp/DEBIAN/control
+ dpkg --build debian-tmp
+ mv debian-tmp.deb ../${PKG}-${P_REV}.deb
+
+source:
+# Makes a source package.
+ chmod +x debian.rules
+ (cd .. && tar cvf ${PKG}-${P_REV}.tar ${PKG} && \
+ gzip -9v ${PKG}-${P_REV}.tar) || exit 1
+
+diff:
+# Makes a diff package.
+ (cd .. && diff -c -P -r ${PKG}.orig ${PKG} \
+ > ${PKG}-${P_REV}.debian.diff; [ $$? = 1 ] && \
+ gzip -9v ${PKG}-${P_REV}.debian.diff) || \
+ exit 1
+
+dist: source diff binary
+# Make source, diff and binary packages
+
diff -Naur byacc.1.9/main.c byacc-1.9/main.c
--- byacc.1.9/main.c 1993-02-22 07:32:46.000000000 +0100
+++ byacc-1.9/main.c 2006-07-03 12:13:56.000000000 +0200
@@ -71,7 +71,9 @@
}
-onintr()
+void
+onintr(signo)
+ int signo;
{
done(1);
}
diff -Naur byacc.1.9/MANIFEST byacc-1.9/MANIFEST
--- byacc.1.9/MANIFEST 1970-01-01 01:00:00.000000000 +0100
+++ byacc-1.9/MANIFEST 2006-07-03 12:13:56.000000000 +0200
@@ -0,0 +1,33 @@
+ File Name Archive # Description
+-----------------------------------------------------------
+ ACKNOWLEDGEMENTS 1
+ CSU.diffs 1
+ MANIFEST 1 This shipping list
+ Makefile 1
+ NEW_FEATURES 1
+ NOTES 1
+ NO_WARRANTY 1
+ README 1
+ closure.c 1
+ defs.h 1
+ error.c 1
+ lalr.c 1
+ lr0.c 1
+ main.c 1
+ mkpar.c 1
+ output.c 2
+ reader.c 3
+ skeleton.c 1
+ symtab.c 1
+ test 1
+ test/error.output 1
+ test/error.tab.c 1
+ test/error.tab.h 1
+ test/error.y 1
+ test/ftp.output 2
+ test/ftp.tab.c 3
+ test/ftp.tab.h 1
+ test/ftp.y 2
+ verbose.c 1
+ warshall.c 1
+ yacc.1 1
diff -Naur byacc.1.9/skeleton.c byacc-1.9/skeleton.c
--- byacc.1.9/skeleton.c 1993-02-22 07:53:26.000000000 +0100
+++ byacc-1.9/skeleton.c 2006-07-03 12:13:56.000000000 +0200
@@ -59,16 +59,25 @@
"#define YYMAXDEPTH 500",
"#endif",
"#endif",
+ // [M.V.] 23.1.2001
+ "#ifndef RECURSIVE",
+ //
"int yydebug;",
"int yynerrs;",
"int yyerrflag;",
"int yychar;",
+ "int lastyystate;",
"short *yyssp;",
"YYSTYPE *yyvsp;",
"YYSTYPE yyval;",
"YYSTYPE yylval;",
"short yyss[YYSTACKSIZE];",
"YYSTYPE yyvs[YYSTACKSIZE];",
+ // [M.V.] 23.1.2001
+ "#else",
+ "#include \"recyacc.h\"",
+ "#endif",
+ //
"#define yystacksize YYSTACKSIZE",
0
};
@@ -80,15 +89,16 @@
"#define YYREJECT goto yyabort",
"#define YYACCEPT goto yyaccept",
"#define YYERROR goto yyerrlab",
+ "#define ERR_RECOVERY_ON 1",
"int",
"yyparse()",
"{",
" register int yym, yyn, yystate;",
"#if YYDEBUG",
" register char *yys;",
- " extern char *getenv();",
+/* " extern char *getenv();", */
"",
- " if (yys = getenv(\"YYDEBUG\"))",
+ " if ((yys = getenv(\"YYDEBUG\")))",
" {",
" yyn = *yys;",
" if (yyn >= '0' && yyn <= '9')",
@@ -105,9 +115,10 @@
" *yyssp = yystate = 0;",
"",
"yyloop:",
- " if (yyn = yydefred[yystate]) goto yyreduce;",
+ " if ((yyn = yydefred[yystate])) goto yyreduce;",
" if (yychar < 0)",
" {",
+ " lastyystate = yystate;",
" if ((yychar = yylex()) < 0) yychar = 0;",
"#if YYDEBUG",
" if (yydebug)",
@@ -135,6 +146,7 @@
" *++yyssp = yystate = yytable[yyn];",
" *++yyvsp = yylval;",
" yychar = (-1);",
+ " if (yyerrflag == 1) yyErrorRecovery();",
" if (yyerrflag > 0) --yyerrflag;",
" goto yyloop;",
" }",
@@ -156,9 +168,9 @@
"yyerrlab:",
" ++yynerrs;",
"yyinrecovery:",
- " if (yyerrflag < 3)",
+ " if (yyerrflag < ERR_RECOVERY_ON)",
" {",
- " yyerrflag = 3;",
+ " yyerrflag = ERR_RECOVERY_ON;",
" for (;;)",
" {",
" if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&",
@@ -241,6 +253,7 @@
" *++yyvsp = yyval;",
" if (yychar < 0)",
" {",
+ " lastyystate = yystate;",
" if ((yychar = yylex()) < 0) yychar = 0;",
"#if YYDEBUG",
" if (yydebug)",
diff -Naur byacc.1.9/skeleton.mar byacc-1.9/skeleton.mar
--- byacc.1.9/skeleton.mar 1970-01-01 01:00:00.000000000 +0100
+++ byacc-1.9/skeleton.mar 2006-07-03 12:13:56.000000000 +0200
@@ -0,0 +1,310 @@
+#include "defs.h"
+
+/* The definition of yysccsid in the banner should be replaced with */
+/* a #pragma ident directive if the target C compiler supports */
+/* #pragma ident directives. */
+/* */
+/* If the skeleton is changed, the banner should be changed so that */
+/* the altered version can be easily distinguished from the original. */
+/* */
+/* The #defines included with the banner are there because they are */
+/* useful in subsequent code. The macros #defined in the header or */
+/* the body either are not useful outside of semantic actions or */
+/* are conditional. */
+
+char *banner[] =
+{
+ "#ifndef lint",
+ "static char yysccsid[] = \"@(#)yaccpar 1.9 (Berkeley) 02/21/93\";",
+ "#endif",
+ "#define YYBYACC 1",
+ "#define YYMAJOR 1",
+ "#define YYMINOR 9",
+ "#define yyclearin (yychar=(-1))",
+ "#define yyerrok (yyerrflag=0)",
+ "#define YYRECOVERING (yyerrflag!=0)",
+ 0
+};
+
+
+char *tables[] =
+{
+ "extern short yylhs[];",
+ "extern short yylen[];",
+ "extern short yydefred[];",
+ "extern short yydgoto[];",
+ "extern short yysindex[];",
+ "extern short yyrindex[];",
+ "extern short yygindex[];",
+ "extern short yytable[];",
+ "extern short yycheck[];",
+ "#if YYDEBUG",
+ "extern char *yyname[];",
+ "extern char *yyrule[];",
+ "#endif",
+ 0
+};
+
+
+char *header[] =
+{
+ "#ifdef YYSTACKSIZE",
+ "#undef YYMAXDEPTH",
+ "#define YYMAXDEPTH YYSTACKSIZE",
+ "#else",
+ "#ifdef YYMAXDEPTH",
+ "#define YYSTACKSIZE YYMAXDEPTH",
+ "#else",
+ "#define YYSTACKSIZE 500",
+ "#define YYMAXDEPTH 500",
+ "#endif",
+ "#endif",
+ "int yydebug;",
+ "int yynerrs;",
+ "int yyerrflag;",
+ "int yychar;",
+ "int lastyystate;",
+ "short *yyssp;",
+ "YYSTYPE *yyvsp;",
+ "YYSTYPE yyval;",
+ "YYSTYPE yylval;",
+ "short yyss[YYSTACKSIZE];",
+ "YYSTYPE yyvs[YYSTACKSIZE];",
+ "#define yystacksize YYSTACKSIZE",
+ 0
+};
+
+
+char *body[] =
+{
+ "#define YYABORT goto yyabort",
+ "#define YYREJECT goto yyabort",
+ "#define YYACCEPT goto yyaccept",
+ "#define YYERROR goto yyerrlab",
+ "int",
+ "yyparse()",
+ "{",
+ " register int yym, yyn, yystate;",
+ "#if YYDEBUG",
+ " register char *yys;",
+/* " extern char *getenv();", */
+ "",
+ " if (yys = getenv(\"YYDEBUG\"))",
+ " {",
+ " yyn = *yys;",
+ " if (yyn >= '0' && yyn <= '9')",
+ " yydebug = yyn - '0';",
+ " }",
+ "#endif",
+ "",
+ " yynerrs = 0;",
+ " yyerrflag = 0;",
+ " yychar = (-1);",
+ "",
+ " yyssp = yyss;",
+ " yyvsp = yyvs;",
+ " *yyssp = yystate = 0;",
+ "",
+ "yyloop:",
+ " if (yyn = yydefred[yystate]) goto yyreduce;",
+ " if (yychar < 0)",
+ " {",
+ " lastyystate = yystate;",
+ " if ((yychar = yylex()) < 0) yychar = 0;",
+ "#if YYDEBUG",
+ " if (yydebug)",
+ " {",
+ " yys = 0;",
+ " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
+ " if (!yys) yys = \"illegal-symbol\";",
+ " printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
+ " YYPREFIX, yystate, yychar, yys);",
+ " }",
+ "#endif",
+ " }",
+ " if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&",
+ " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)",
+ " {",
+ "#if YYDEBUG",
+ " if (yydebug)",
+ " printf(\"%sdebug: state %d, shifting to state %d\\n\",",
+ " YYPREFIX, yystate, yytable[yyn]);",
+ "#endif",
+ " if (yyssp >= yyss + yystacksize - 1)",
+ " {",
+ " goto yyoverflow;",
+ " }",
+ " *++yyssp = yystate = yytable[yyn];",
+ " *++yyvsp = yylval;",
+ " yychar = (-1);",
+ " if (yyerrflag == 1) yyErrorRecovery();",
+ " if (yyerrflag > 0) --yyerrflag;",
+ " goto yyloop;",
+ " }",
+ " if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&",
+ " yyn <= YYTABLESIZE && yycheck[yyn] == yychar)",
+ " {",
+ " yyn = yytable[yyn];",
+ " goto yyreduce;",
+ " }",
+ " if (yyerrflag) goto yyinrecovery;",
+ "#ifdef lint",
+ " goto yynewerror;",
+ "#endif",
+ "yynewerror:",
+ " yyerror(\"syntax error\");",
+ "#ifdef lint",
+ " goto yyerrlab;",
+ "#endif",
+ "yyerrlab:",
+ " ++yynerrs;",
+ "yyinrecovery:",
+ " if (yyerrflag < 1)",
+ " {",
+ " yyerrflag = 1;",
+ " for (;;)",
+ " {",
+ " if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&",
+ " yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)",
+ " {",
+ "#if YYDEBUG",
+ " if (yydebug)",
+ " printf(\"%sdebug: state %d, error recovery shifting\\",
+ " to state %d\\n\", YYPREFIX, *yyssp, yytable[yyn]);",
+ "#endif",
+ " if (yyssp >= yyss + yystacksize - 1)",
+ " {",
+ " goto yyoverflow;",
+ " }",
+ " *++yyssp = yystate = yytable[yyn];",
+ " *++yyvsp = yylval;",
+ " goto yyloop;",
+ " }",
+ " else",
+ " {",
+ "#if YYDEBUG",
+ " if (yydebug)",
+ " printf(\"%sdebug: error recovery discarding state %d\
+\\n\",",
+ " YYPREFIX, *yyssp);",
+ "#endif",
+ " if (yyssp <= yyss) goto yyabort;",
+ " --yyssp;",
+ " --yyvsp;",
+ " }",
+ " }",
+ " }",
+ " else",
+ " {",
+ " if (yychar == 0) goto yyabort;",
+ "#if YYDEBUG",
+ " if (yydebug)",
+ " {",
+ " yys = 0;",
+ " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
+ " if (!yys) yys = \"illegal-symbol\";",
+ " printf(\"%sdebug: state %d, error recovery discards token %d\
+ (%s)\\n\",",
+ " YYPREFIX, yystate, yychar, yys);",
+ " }",
+ "#endif",
+ " yychar = (-1);",
+ " goto yyloop;",
+ " }",
+ "yyreduce:",
+ "#if YYDEBUG",
+ " if (yydebug)",
+ " printf(\"%sdebug: state %d, reducing by rule %d (%s)\\n\",",
+ " YYPREFIX, yystate, yyn, yyrule[yyn]);",
+ "#endif",
+ " yym = yylen[yyn];",
+ " yyval = yyvsp[1-yym];",
+ " switch (yyn)",
+ " {",
+ 0
+};
+
+
+char *trailer[] =
+{
+ " }",
+ " yyssp -= yym;",
+ " yystate = *yyssp;",
+ " yyvsp -= yym;",
+ " yym = yylhs[yyn];",
+ " if (yystate == 0 && yym == 0)",
+ " {",
+ "#if YYDEBUG",
+ " if (yydebug)",
+ " printf(\"%sdebug: after reduction, shifting from state 0 to\\",
+ " state %d\\n\", YYPREFIX, YYFINAL);",
+ "#endif",
+ " yystate = YYFINAL;",
+ " *++yyssp = YYFINAL;",
+ " *++yyvsp = yyval;",
+ " if (yychar < 0)",
+ " {",
+ " lastyystate = yystate;",
+ " if ((yychar = yylex()) < 0) yychar = 0;",
+ "#if YYDEBUG",
+ " if (yydebug)",
+ " {",
+ " yys = 0;",
+ " if (yychar <= YYMAXTOKEN) yys = yyname[yychar];",
+ " if (!yys) yys = \"illegal-symbol\";",
+ " printf(\"%sdebug: state %d, reading %d (%s)\\n\",",
+ " YYPREFIX, YYFINAL, yychar, yys);",
+ " }",
+ "#endif",
+ " }",
+ " if (yychar == 0) goto yyaccept;",
+ " goto yyloop;",
+ " }",
+ " if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&",
+ " yyn <= YYTABLESIZE && yycheck[yyn] == yystate)",
+ " yystate = yytable[yyn];",
+ " else",
+ " yystate = yydgoto[yym];",
+ "#if YYDEBUG",
+ " if (yydebug)",
+ " printf(\"%sdebug: after reduction, shifting from state %d \\",
+ "to state %d\\n\", YYPREFIX, *yyssp, yystate);",
+ "#endif",
+ " if (yyssp >= yyss + yystacksize - 1)",
+ " {",
+ " goto yyoverflow;",
+ " }",
+ " *++yyssp = yystate;",
+ " *++yyvsp = yyval;",
+ " goto yyloop;",
+ "yyoverflow:",
+ " yyerror(\"yacc stack overflow\");",
+ "yyabort:",
+ " return (1);",
+ "yyaccept:",
+ " return (0);",
+ "}",
+ 0
+};
+
+
+write_section(section)
+char *section[];
+{
+ register int c;
+ register int i;
+ register char *s;
+ register FILE *f;
+
+ f = code_file;
+ for (i = 0; s = section[i]; ++i)
+ {
+ ++outline;
+ while (c = *s)
+ {
+ putc(c, f);
+ ++s;
+ }
+ putc('\n', f);
+ }
+}