bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFA: Proposed patch to fix incorrect table optimization for GLR


From: Paul Hilfinger
Subject: RFA: Proposed patch to fix incorrect table optimization for GLR
Date: Tue, 29 Oct 2002 18:17:08 -0800

I propose the following patch to fix a problem with GLR parsers.  When 
packing tables, the rows for two states may be merged if they turn out
to be identical (the table construction would not normally produce
redundant states, but they can result when default reductions are
substituted for some entries).  The matching does not take into
account extra information for the GLR parser.  Here, I conservatively
avoid merging states with such information.  The glr-regr1.at test
that I just checked in shows the problem.

Comments?

P. Hilfinger


ChangeLog entry:

2002-10-29  Paul Hilfinger  <address@hidden>

        * src/tables.c (matching_state): Don't allow states to match if 
        either has GLR conflict entries.


Index: bison-1_5.43/src/tables.c
--- bison-1_5.43/src/tables.c Fri, 25 Oct 2002 19:21:18 -0700 hilfingr 
(glrbison/g/41_tables.c 1.2 644)
+++ bison-1_5.47(w)/src/tables.c Tue, 29 Oct 2002 15:36:52 -0800 hilfingr 
(glrbison/g/41_tables.c 1.3 644)
@@ -610,6 +610,15 @@ matching_state (vector_number_t vector)
   t = tally[i];
   w = width[i];
 
+  /* If VECTOR has GLR conflicts, return -1 */
+  if (conflict_tos[i] != NULL)
+    {
+      int j;
+      for (j = 0; j < t; j += 1)
+       if (conflict_tos[i][j] != 0)
+         return -1;
+    }
+
   for (prev = vector - 1; prev >= 0; prev--)
     {
       vector_number_t j = order[prev];
@@ -622,7 +631,8 @@ matching_state (vector_number_t vector)
        return -1;
 
       for (k = 0; match && k < t; k++)
-       if (tos[j][k] != tos[i][k] || froms[j][k] != froms[i][k])
+       if (tos[j][k] != tos[i][k] || froms[j][k] != froms[i][k]
+           || (conflict_tos[j] != NULL && conflict_tos[j][k] != 0))
          match = 0;
 
       if (match)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]