intermediate checkpoint
authoradam <adam@megacz.com>
Sun, 8 Jan 2006 03:50:43 +0000 (22:50 -0500)
committeradam <adam@megacz.com>
Sun, 8 Jan 2006 03:50:43 +0000 (22:50 -0500)
darcs-hash:20060108035043-5007d-c8ccd495e43468587e836f51d74992f86834aa10.gz

src/edu/berkeley/sbp/GSS.java
tests/regression.tc

index 2b8be3b..9ab6587 100644 (file)
@@ -230,17 +230,28 @@ class GSS {
             return true;
         }
 
             return true;
         }
 
+        public void uninhibit(int p, Sequence s) {
+            if (s.hated!=null)
+                for(Sequence s2 : s.hated)
+                    inhibited.remove(p, s2);
+        }
+
         public void inhibit(Reduction r, int p) {
             if (r.position.owner().hated == null) return;
             // remember that dead states are still allowed to shift -- just not allowed to reduce
         public void inhibit(Reduction r, int p) {
             if (r.position.owner().hated == null) return;
             // remember that dead states are still allowed to shift -- just not allowed to reduce
+            boolean reset = false;
             for(Sequence seq : r.position.owner().hated) {
                 if (performed.contains(p,seq)) {
             for(Sequence seq : r.position.owner().hated) {
                 if (performed.contains(p,seq)) {
-                    inhibited.clear();
-                    inhibited.add(p, seq);
-                    resets++;
-                    throw new Reset();
+                    uninhibit(p, seq);
+                    //System.out.println("\nresetting due to " + r.position.owner() + " killing " + seq);
+                    if (!reset) inhibited.add(p, seq);
+                    reset = true;
                 }
                 }
-                inhibited.add(p, seq);
+                if (!reset) inhibited.add(p, seq);
+            }
+            if (reset) {
+                resets++;
+                throw new Reset();
             }
         }
         
             }
         }
         
@@ -321,7 +332,7 @@ class GSS {
                 this.reduction = reduction;
             }
             public void perform() {
                 this.reduction = reduction;
             }
             public void perform() {
-                System.out.println("performing: " + reduction.position);
+                //System.out.println("performing: " + reduction.position);
                 newNode(parent, pending, state, fromEmptyReduction, reduction);
             }
         }
                 newNode(parent, pending, state, fromEmptyReduction, reduction);
             }
         }
index 025500a..37a302e 100644 (file)
@@ -255,59 +255,61 @@ testcase {
   q  ::= [a-z]++ => "q"
 }
 
   q  ::= [a-z]++ => "q"
 }
 
-//testcase {
-//
-//    input "
-//
-//
-// while x>0
-//   while y>0
-//    foo()
-//     bar()
-//
-// while x>0
-//   while y>0
-//    foo()
-//   bar()
-//
-//
-//";
-//    output "smt:{while:{>:{{x} {0}} while:{>:{{y} {0}} sbb:{{f o o} {b a r}}}}}";
-//    output "smt:{while:{>:{{x} {0}} sbb:{while:{>:{{y} {0}} {f o o}} {b a r}}}}";
-//
-//indent  !::= ww
-//outdent !::= " "  outdent " "
-//           | " "  (~[]*)  "\n"
-//
-//any      !::= ~[]*
-//s         ::= any "\n\n" ww statement ww "\n\n" any => smt
-//ww       !::= sp*
-//ws       !::= sp**
-//sp        ::= " "
-//
-//block     ::= "\n" indent  blockBody
-//           &~ "\n" outdent ~[\ ] ~[]*
-//
-//blockBody ::= statement
-//            > statement blockBody /ws => "sbb"
-//
-//statement ::= call
-//            | ^"while" expr block /ws
-//
-//expr      ::= ident
-//            | call
-//            | expr ^">" expr   /ws
-//            | num
-//
-//call      ::= expr "()"        /ws
-//
-//num       ::= [0-9]++
-//
-//ident     ::= [a-z]++ &~ keyword
-//keyword   ::= "if" | "then" | "else" | "while"
-//
-//w         ::= " " | "\n" | "\r"
-//ws        ::= w*
-//
-//
-//}
+testcase {
+
+    input "
+
+
+
+ while x>0
+   while y>0
+    foo()
+   bar()
+
+ while x>0
+   while y>0
+    foo()
+     bar()
+
+
+
+";
+     output "smt:{while:{>:{{x} {0}} sbb:{while:{>:{{y} {0}} {f o o}} {b a r}}} while:{>:{{x} {0}} while:{>:{{y} {0}} sbb:{{f o o} {b a r}}}}}";
+     output "smt:{while:{>:{{x} {0}} sbb:{while:{>:{{y} {0}} {f o o}} {b a r}}} while:{>:{{x} {0}} sbb:{while:{>:{{y} {0}} {f o o}} {b a r}}}}";
+
+indent  !::= ww
+outdent !::= " "  outdent " "
+           | " "  (~[]*)  "\n"
+
+w        !::= " " | "\n" | "\r"
+ws       !::= w*
+ww       !::= sp*
+sp       !::= " "
+any      !::= ~[]*
+
+s         ::= ws statement ws statement ws => smt
+
+block     ::= "\n" indent  blockBody
+           &~ "\n" outdent ~[\ ] ~[]*
+
+blockBody ::= statement
+            | statement ws blockBody => "sbb"
+
+statement ::= call
+            | ^"while" expr block /ws
+
+expr      ::= ident
+            | call
+            | expr ^">" expr   /ws
+            | num
+
+call      ::= expr "()"        /ws
+
+num       ::= [0-9]++
+
+ident     ::= [a-z]++ &~ keyword
+keyword   ::= "if" | "then" | "else" | "while"
+
+
+
+}