[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Proposal for lambda'ing error recovery
From: |
Akim Demaille |
Subject: |
Re: Proposal for lambda'ing error recovery |
Date: |
Mon, 18 Nov 2002 15:30:46 +0100 |
User-agent: |
Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-pc-linux-gnu) |
akim> This patch is going into the direction I'd like yacc.c to take: more
akim> functions, and less inlined code. But it means that we need to
akim> pass some variable addresses, hence they no longer can be register'd.
akim> I dobt very much that this can have a significant influence. Any
akim> way, this is a simple but painful functionification of the error
akim> recovery. The next step will be to do as we do in glr.c, imho.
Well, I have not received any comment about the patch. I really can't
imagine any impact on the performance because of `register' here, and
anyway the test suite sees no difference. Here is the wdiff on
/before/, *after* the patch.
testsuite: starting at: Mon Nov 18 /10:49:39/ *13:07:38* CET 2002
1. input.at:28: ok /(0m0.010s 0m0.010s)/ *(0m0.000s 0m0.000s)*
2. input.at:46: ok /(0m0.020s 0m0.000s)/ *(0m0.010s 0m0.010s)*
3. input.at:64: ok /(0m0.000s 0m0.010s)/ *(0m0.010s 0m0.000s)*
4. input.at:93: ok /(0m0.390s 0m0.080s)/ *(0m0.410s 0m0.110s)*
5. output.at:38: ok /(0m0.090s 0m0.040s)/ *(0m0.100s 0m0.050s)*
6. output.at:40: ok /(0m0.100s 0m0.030s)/ *(0m0.130s 0m0.010s)*
7. output.at:42: ok (0m0.110s /0m0.020s)/ *0m0.040s)*
8. output.at:44: ok /(0m0.110s/ *(0m0.100s* 0m0.040s)
9. output.at:46: ok /(0m0.090s 0m0.020s)/ *(0m0.110s 0m0.030s)*
10. output.at:48: ok /(0m0.100s/ *(0m0.110s* 0m0.010s)
11. output.at:52: ok /(0m0.100s 0m0.020s)/ *(0m0.080s 0m0.060s)*
12. output.at:54: ok /(0m0.110s 0m0.040s)/ *(0m0.090s 0m0.050s)*
13. output.at:57: ok /(0m0.100s 0m0.030s)/ *(0m0.110s 0m0.010s)*
14. output.at:61: ok (0m0.110s /0m0.020s)/ *0m0.040s)*
15. output.at:63: ok /(0m0.110s 0m0.020s)/ *(0m0.080s 0m0.070s)*
16. output.at:67: ok (0m0.100s /0m0.030s)/ *0m0.040s)*
17. output.at:72: ok (0m0.100s /0m0.030s)/ *0m0.040s)*
18. output.at:75: ok /(0m0.090s 0m0.050s)/ *(0m0.120s 0m0.020s)*
19. output.at:79: ok /(0m0.110s 0m0.030s)/ *(0m0.100s 0m0.040s)*
20. output.at:83: ok /(0m0.110s 0m0.010s)/ *(0m0.090s 0m0.050s)*
21. sets.at:66: ok /(0m0.140s 0m0.030s)/ *(0m0.130s 0m0.040s)*
22. sets.at:151: ok /(0m0.120s 0m0.030s)/ *(0m0.100s 0m0.060s)*
23. sets.at:193: ok /(0m0.110s 0m0.080s)/ *(0m0.120s 0m0.060s)*
24. reduce.at:26: ok /(0m0.100s/ *(0m0.110s* 0m0.030s)
25. reduce.at:70: ok /(0m0.090s 0m0.060s)/ *(0m0.110s 0m0.040s)*
26. reduce.at:125: ok /(0m0.100s 0m0.010s)/ *(0m0.130s 0m0.020s)*
27. reduce.at:212: ok (0m0.200s 0m0.070s)
28. reduce.at:301: ok /(0m0.110s 0m0.020s)/ *(0m0.100s 0m0.050s)*
29. reduce.at:342: ok /(0m0.030s/ *(0m0.010s* 0m0.010s)
30. synclines.at:93: ok (0m0.240s 0m0.130s)
31. synclines.at:112: ok /(0m0.240s 0m0.120s)/ *(0m0.280s 0m0.080s)*
32. synclines.at:135: ok /(0m0.250s 0m0.120s)/ *(0m0.290s 0m0.100s)*
33. synclines.at:154: ok /(0m0.220s/ *(0m0.270s* 0m0.110s)
34. synclines.at:172: ok /(0m0.220s 0m0.140s)/ *(0m0.260s 0m0.120s)*
35. headers.at:27: ok (0m0.110s /0m0.000s)/ *0m0.010s)*
36. headers.at:76: ok /(0m0.120s/ *(0m0.110s* 0m0.040s)
37. headers.at:77: ok /(0m0.100s/ *(0m0.110s* 0m0.050s)
38. headers.at:86: ok /(0m0.470s 0m0.090s)/ *(0m0.480s 0m0.100s)*
39. actions.at:25: ok (0m0.570s 0m0.070s)
40. actions.at:89: ok /(0m0.480s 0m0.080s)/ *(0m0.510s 0m0.070s)*
41. actions.at:236: ok /(0m0.490s 0m0.080s)/ *(0m0.520s 0m0.060s)*
42. actions.at:515: ok /(0m0.650s 0m0.090s)/ *(0m0.700s 0m0.060s)*
43. actions.at:516: FAILED near `actions.at:516' /(0m0.650s 0m0.090s)/
*(0m0.700s 0m0.060s)*
44. conflicts.at:31: ok /(0m0.100s 0m0.020s)/ *(0m0.080s 0m0.030s)*
45. conflicts.at:51: ok /(0m0.420s 0m0.150s)/ *(0m0.490s 0m0.090s)*
46. conflicts.at:131: ok /(0m0.110s 0m0.020s)/ *(0m0.090s 0m0.030s)*
47. conflicts.at:238: ok /(0m0.090s 0m0.050s)/ *(0m0.100s 0m0.040s)*
48. conflicts.at:360: ok /(0m0.110s 0m0.010s)/ *(0m0.090s 0m0.030s)*
49. conflicts.at:479: ok (0m0.020s /0m0.000s)/ *0m0.010s)*
50. conflicts.at:499: ok /(0m0.080s 0m0.030s)/ *(0m0.100s 0m0.020s)*
51. conflicts.at:516: ok (0m0.010s 0m0.010s)
52. calc.at:546: ok /(0m0.620s 0m0.280s)/ *(0m0.600s 0m0.290s)*
53. calc.at:548: ok /(0m0.560s 0m0.320s)/ *(0m0.600s 0m0.330s)*
54. calc.at:549: ok /(0m0.640s 0m0.360s)/ *(0m0.620s 0m0.350s)*
55. calc.at:550: ok /(0m0.590s 0m0.330s)/ *(0m0.610s 0m0.280s)*
56. calc.at:551: ok /(0m0.580s 0m0.320s)/ *(0m0.640s 0m0.330s)*
57. calc.at:552: ok /(0m0.610s/ *(0m0.580s* 0m0.320s)
58. calc.at:553: ok /(0m0.680s 0m0.250s)/ *(0m0.640s 0m0.270s)*
59. calc.at:555: ok /(0m0.720s 0m0.250s)/ *(0m0.680s 0m0.260s)*
60. calc.at:557: ok /(0m0.680s 0m0.290s)/ *(0m0.740s 0m0.240s)*
61. calc.at:559: ok /(0m0.740s 0m0.540s)/ *(0m0.760s 0m0.500s)*
62. calc.at:560: ok /(0m0.860s 0m0.410s)/ *(0m0.930s 0m0.340s)*
63. calc.at:562: ok /(0m0.830s 0m0.490s)/ *(0m0.890s 0m0.470s)*
64. calc.at:564: ok /(0m0.830s 0m0.460s)/ *(0m0.930s 0m0.480s)*
65. calc.at:581: ok /(0m1.460s 0m0.300s)/ *(0m1.340s 0m0.340s)*
66. calc.at:583: ok /(0m1.360s 0m0.380s)/ *(0m1.370s 0m0.300s)*
67. calc.at:584: ok /(0m1.390s 0m0.310s)/ *(0m1.290s 0m0.300s)*
68. calc.at:585: ok /(0m1.410s 0m0.330s)/ *(0m1.340s 0m0.310s)*
69. calc.at:586: ok /(0m1.380s 0m0.340s)/ *(0m1.420s 0m0.220s)*
70. calc.at:587: ok /(0m1.370s 0m0.420s)/ *(0m1.310s 0m0.320s)*
71. calc.at:588: ok /(0m1.520s/ *(0m1.340s* 0m0.280s)
72. calc.at:590: ok /(0m1.460s 0m0.310s)/ *(0m1.320s 0m0.200s)*
73. calc.at:592: ok /(0m1.350s 0m0.320s)/ *(0m1.310s 0m0.330s)*
74. calc.at:594: ok /(0m1.680s 0m0.290s)/ *(0m1.510s 0m0.340s)*
75. calc.at:595: ok /(0m1.730s 0m0.260s)/ *(0m1.580s 0m0.310s)*
76. calc.at:597: ok /(0m1.760s 0m0.290s)/ *(0m1.640s 0m0.320s)*
77. calc.at:599: ok /(0m1.820s 0m0.350s)/ *(0m1.710s 0m0.280s)*
78. torture.at:140: ok /(0m5.070s 0m0.420s)/ *(0m4.720s 0m0.480s)*
79. torture.at:231: ok /(0m40.340s 0m0.600s)/ *(0m37.400s 0m0.490s)*
80. torture.at:366: ok /(1m35.230s 0m0.610s)/ *(1m31.190s 0m0.710s)*
81. torture.at:440: ok /(0m1.570s 0m6.120s)/ *(0m1.490s 0m5.550s)*
82. torture.at:461: ok /(0m1.650s 0m7.280s)/ *(0m1.500s 0m5.500s)*
83. existing.at:24: ok /(0m0.320s 0m0.020s)/ *(0m0.310s 0m0.030s)*
84. existing.at:364: ok /(0m0.980s 0m0.070s)/ *(0m0.970s 0m0.030s)*
85. regression.at:27: ok /(0m0.210s 0m0.060s)/ *(0m0.230s 0m0.070s)*
86. regression.at:65: ok /(0m0.090s/ *(0m0.100s* 0m0.030s)
87. regression.at:87: ok /(0m0.070s/ *(0m0.080s* 0m0.030s)
88. regression.at:113: ok /(0m0.080s 0m0.050s)/ *(0m0.100s 0m0.010s)*
89. regression.at:257: ok /(0m0.100s 0m0.010s)/ *(0m0.090s 0m0.030s)*
90. regression.at:280: ok /(0m0.000s 0m0.030s)/ *(0m0.010s 0m0.010s)*
91. regression.at:313: ok (0m0.240s /0m0.010s)/ *0m0.050s)*
92. regression.at:341: ok /(0m0.230s 0m0.040s)/ *(0m0.270s 0m0.000s)*
93. regression.at:372: ok /(0m0.090s 0m0.060s)/ *(0m0.110s 0m0.020s)*
94. regression.at:549: ok /(0m0.100s 0m0.050s)/ *(0m0.110s 0m0.030s)*
95. cxx-type.at:255: ok /(0m1.180s/ *(0m1.140s* 0m0.110s)
96. cxx-type.at:262: ok /(0m1.210s 0m0.110s)/ *(0m1.110s 0m0.100s)*
97. cxx-type.at:268: ok /(0m1.230s 0m0.090s)/ *(0m1.120s 0m0.110s)*
98. cxx-type.at:275: ok /(0m1.220s 0m0.100s)/ *(0m1.110s 0m0.110s)*
99. cxx-type.at:282: ok /(0m1.210s 0m0.100s)/ *(0m1.150s 0m0.110s)*
100. cxx-type.at:289: ok /(0m1.210s 0m0.090s)/ *(0m1.150s 0m0.080s)*
101. cxx-type.at:296: ok /(0m1.210s 0m0.080s)/ *(0m1.170s 0m0.100s)*
102. cxx-type.at:302: ok /(0m1.240s 0m0.110s)/ *(0m1.110s 0m0.130s)*
103. cxx-type.at:309: ok /(0m1.270s 0m0.100s)/ *(0m1.190s 0m0.090s)*
104. glr-regr1.at:21: ok /(0m1.120s 0m0.180s)/ *(0m1.190s 0m0.040s)*
testsuite: ending at: Mon Nov 18 /10:54:04/ *13:11:51* CET 2002
testsuite: test suite duration: 0h 4m /25s/ *13s*
Of course it shows also the time required to compile etc... Here is
another check,
./testsuite PREPARSER='/usr/bin/time --output=/tmp/parser.old --append
--format=%Uu-%Ss'
And again, here are the diffs :
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.01u-0.00s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.02s 0.00u-0.02s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.01u-0.00s | 0.00u-0.00s
0.00u-0.01s 0.00u-0.01s
0.02u-0.00s | 0.00u-0.02s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.02s | 0.00u-0.03s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.01u-0.01s | 0.01u-0.02s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.01u-0.00s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.01u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.01u-0.00s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.02s 0.00u-0.02s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.01u-0.00s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.01u-0.00s | 0.00u-0.03s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.02s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.01u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s 0.00u-0.01s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s | 0.00u-0.01s
0.81u-5.16s 0.81u-5.16s
0.11u-0.74s | 0.18u-0.83s
0.00u-0.01s | 0.00u-0.00s
0.87u-4.33s | 0.92u-4.50s
0.11u-0.73s | 0.14u-0.74s
Hm... I wonder if this is ``significant''.
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.01u-0.00s | 0.00u-0.00s
0.00u-0.00s | 0.01u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.01s | 0.00u-0.00s
0.01u-0.00s | 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
0.00u-0.00s 0.00u-0.00s
Here is the patch I'd like to install:
Index: ChangeLog
from Akim Demaille <address@hidden>
* data/yacc.c (YYPPOPSTACK, yy_status_type)
(yy_recover_parse_error): New.
(yyparse): Instead of inlined code for error recovery, use
yy_recover_parse_error. This requires that yyssp, yyvsp, and
yystate no longer be `register'.
Index: data/glr.c
===================================================================
RCS file: /cvsroot/bison/bison/data/glr.c,v
retrieving revision 1.40
diff -u -u -r1.40 glr.c
--- data/glr.c 18 Nov 2002 07:51:47 -0000 1.40
+++ data/glr.c 18 Nov 2002 12:19:56 -0000
@@ -1642,8 +1642,7 @@
{
if (*yytokenp == YYEOF)
{
- /* Now pop stack until we find a state that shifts the
- error token. */
+ /* Cannot recover: flush the stack. */
while (yystack->yytops.yystates[0] != NULL)
{
yyGLRState *yys = yystack->yytops.yystates[0];
@@ -1692,7 +1691,7 @@
yyremoveDeletes (yystack);
yycompressStack (yystack);
- /* Now pop stack until we find a state that shifts the error token. */
+ /* Now pop stack until we find a state that shifts the error token. */
while (yystack->yytops.yystates[0] != NULL)
{
yyGLRState *yys = yystack->yytops.yystates[0];
Index: data/yacc.c
===================================================================
RCS file: /cvsroot/bison/bison/data/yacc.c,v
retrieving revision 1.38
diff -u -u -r1.38 yacc.c
--- data/yacc.c 16 Nov 2002 12:32:27 -0000 1.38
+++ data/yacc.c 18 Nov 2002 12:19:57 -0000
@@ -497,6 +497,11 @@
#define YYTERROR 1
#define YYERRCODE 256
+#define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
+
+#define YYPPOPSTACK \
+ ((*yyvspp)--, (*yysspp)--]b4_location_if([, (*yylspp)--])[)
+
/* YYLLOC_DEFAULT -- Compute the default location (before the actions
are run). */
@@ -547,9 +552,10 @@
} \
} while (0)
+
/*------------------------------------------------------------------.
| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (cinluded). |
+| TOP (included). |
`------------------------------------------------------------------*/
]b4_c_function_def([yy_stack_print], [static void],
@@ -683,7 +689,101 @@
#if YYDEBUG
]b4_yysymprint_generate([b4_c_function_def])[
#endif /* ! YYDEBUG */
-]b4_yydestruct_generate([b4_c_function_def])
+]b4_yydestruct_generate([b4_c_function_def])[
+
+
+/*--------------------------------------------------------------------.
+| yy_recover_parse_error -- Recover from a syntax error on YYSTACK, |
+| assuming that YYTOKENP, YYLVALP, and YYLLOCP point to the |
+| syntactic category, semantic value, and location of the lookahead. |
+`--------------------------------------------------------------------*/
+
+typedef enum {
+ yy_ok,
+ yy_abort,
+ yy_accept
+} yy_status_type;
+
+]b4_c_function_def([yy_recover_parse_error], [static yy_status_type],
+ [[int *yystatep], [yystatep]],
+ [[int *yyerrstatusp], [yyerrstatusp]],
+ [[short *yyss], [yyss]],
+ [[int *yytokenp], [yytokenp]],
+ [[short **yysspp], [yysspp]],
+ [[YYSTYPE *yylvalp], [yylvalp]],
+ [[YYSTYPE **yyvspp], [yyvspp]]b4_location_if([,
+ [[YYLTYPE *yyllocp], [yyllocp]],
+ [[YYLTYPE **yylspp], [yylspp]]]))[
+{
+ int yyn;
+ if (*yyerrstatusp == 3)
+ {
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
+
+ /* Return failure if at end of input. */
+ if (*yytokenp == YYEOF)
+ {
+ /* Pop the error token. */
+ YYPPOPSTACK;
+ /* Pop the rest of the stack. */
+ while (yyss < *yysspp)
+ {
+ YYDSYMPRINTF ("Error: popping",
+ yystos[**yysspp], *yyvspp, *yylspp);
+ yydestruct (yystos[**yysspp], *yyvspp]b4_location_if([,
*yylspp])[);
+ YYPPOPSTACK;
+ }
+ return yy_abort;
+ }
+
+ YYDSYMPRINTF ("Error: discarding", *yytokenp, yylvalp, yyllocp);
+ yydestruct (*yytokenp, yylvalp]b4_location_if([, yyllocp])[);
+ *yytokenp = YYEMPTY;
+ }
+
+ /* Else will try to reuse lookahead token after shifting the error
+ token. */
+
+ *yyerrstatusp = 3; /* Each real token shifted decrements this. */
+
+ for (;;)
+ {
+ yyn = yypact[*yystatep];
+ if (yyn != YYPACT_NINF)
+ {
+ yyn += YYTERROR;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
+
+ /* Pop the current state because it cannot handle the error token. */
+ if (*yysspp == yyss)
+ return yy_abort;
+
+ YYDSYMPRINTF ("Error: popping", yystos[**yysspp], *yyvspp, *yylspp);
+ yydestruct (yystos[*yystatep], *yyvspp]b4_location_if([, *yylspp])[);
+ YYPPOPSTACK;
+ *yystatep = **yysspp;
+ YY_STACK_PRINT (yyss, *yysspp);
+ }
+
+ if (yyn == YYFINAL)
+ return yy_accept;
+
+ YYDPRINTF ((stderr, "Shifting error token, "));
+
+ *++(*yyvspp) = *yylvalp;
+]b4_location_if([ *++(*yylspp) = *yyllocp;])[
+
+ *yystatep = yyn;
+ return yy_ok;
+}
+
/* Prevent warnings from -Wmissing-prototypes. */
@@ -695,11 +795,11 @@
int yyparse ();
# endif
#else /* ! YYPARSE_PARAM */
-b4_c_function_decl([yyparse], [int], b4_parse_param)
+]b4_c_function_decl([yyparse], [int], b4_parse_param)[
#endif /* ! YYPARSE_PARAM */
-m4_divert_push([KILL])# ======================== M4 code.
+]m4_divert_push([KILL])# ======================== M4 code.
# b4_declare_parser_variables
# ---------------------------
# Declare the variables that are global, or local to YYPARSE if
@@ -719,7 +819,7 @@
m4_divert_pop([KILL])dnl# ====================== End of M4 code.
b4_pure_if([],
- [b4_declare_parser_variables])
+ [b4_declare_parser_variables])[
/*----------.
@@ -734,11 +834,11 @@
void *YYPARSE_PARAM;
# endif
#else /* ! YYPARSE_PARAM */
-b4_c_function_def([yyparse], [int], b4_parse_param)
+]b4_c_function_def([yyparse], [int], b4_parse_param)[
#endif
-{[
+{
]b4_pure_if([b4_declare_parser_variables])[
- register int yystate;
+ int yystate;
register int yyn;
int yyresult;
/* Number of tokens to shift before error messages enabled. */
@@ -757,12 +857,12 @@
/* The state stack. */
short yyssa[YYINITDEPTH];
short *yyss = yyssa;
- register short *yyssp;
+ short *yyssp;
/* The semantic value stack. */
YYSTYPE yyvsa[YYINITDEPTH];
YYSTYPE *yyvs = yyvsa;
- register YYSTYPE *yyvsp;
+ YYSTYPE *yyvsp;
]b4_location_if(
[[ /* The location stack. */
@@ -770,8 +870,6 @@
YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp;]])[
-#define YYPOPSTACK (yyvsp--, yyssp--]b4_location_if([, yylsp--])[)
-
YYSIZE_T yystacksize = YYINITDEPTH;
/* The variables used to return semantic value and location from the
@@ -907,15 +1005,9 @@
}
if (yytoken == YYEOF)
- {
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
+ YYDPRINTF ((stderr, "Now at end of input.\n"));
else
- {
- /* We have to keep this `#if YYDEBUG', since we use variables
- which are defined only if `YYDEBUG' is set. */
- YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
- }
+ YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc);
/* If the proper action on seeing token YYTOKEN is to reduce or to
detect an error, take that action. */
@@ -1080,73 +1172,21 @@
| yyerrlab1 -- error raised explicitly by an action. |
`----------------------------------------------------*/
yyerrlab1:
- if (yyerrstatus == 3)
+ switch (yy_recover_parse_error (&yystate, &yyerrstatus, yyss,
+ &yytoken, &yyssp,
+ &yylval, &yyvsp]b4_location_if([,
+ &yylloc, &yylsp])[))
{
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- /* Return failure if at end of input. */
- if (yytoken == YYEOF)
- {
- /* Pop the error token. */
- YYPOPSTACK;
- /* Pop the rest of the stack. */
- while (yyss < yyssp)
- {
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[*yyssp], yyvsp]b4_location_if([, yylsp])[);
- YYPOPSTACK;
- }
- YYABORT;
- }
-
- YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc);
- yydestruct (yytoken, &yylval]b4_location_if([, &yylloc])[);
- yytoken = YYEMPTY;
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
-
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
- YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp);
- yydestruct (yystos[yystate], yyvsp]b4_location_if([, yylsp])[);
- yyvsp--;
- yystate = *--yyssp;
-]b4_location_if([ yylsp--;])[
- YY_STACK_PRINT (yyss, yyssp);
+ case yy_accept:
+ goto yyacceptlab;
+ break;
+ case yy_abort:
+ goto yyabortlab;
+ break;
+ default:
+ break;
}
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- YYDPRINTF ((stderr, "Shifting error token, "));
-
- *++yyvsp = yylval;
-]b4_location_if([ *++yylsp = yylloc;])[
-
- yystate = yyn;
goto yynewstate;
-
/*-------------------------------------.
| yyacceptlab -- YYACCEPT comes here. |