checkpoint
authoradam <adam@megacz.com>
Sun, 15 Jan 2006 08:10:01 +0000 (03:10 -0500)
committeradam <adam@megacz.com>
Sun, 15 Jan 2006 08:10:01 +0000 (03:10 -0500)
darcs-hash:20060115081001-5007d-1ef9071d36d02f216091f2340d73129306cbed36.gz

TODO
src/edu/berkeley/sbp/Walk.java
tests/regression.tc

diff --git a/TODO b/TODO
index 1ad1494..fb89b52 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,18 +1,16 @@
 _____________________________________________________________________________
 Immediately
 
 _____________________________________________________________________________
 Immediately
 
-  * pick back up cleaning up end of Parser.java (Reduction)
-
-  - [more] sensible tree-printout
-
-  - revamp Tib.Block (do it all in the parser using indent/dedent?)
-
-  - more natural phrasing of metagrammar?
-  - finalize metagrammar and rdp-op's
+  - clean up the whole Walk situation (?)
 
   - decent/better error messages
       - fix the location stuff, it's broken
 
 
   - decent/better error messages
       - fix the location stuff, it's broken
 
+
+______________________________________________________________________________
+v1.1
+
+  - finalize metagrammar and rdp-op's
   - write some grammars
       - Java grammar
       - TeX (math?)
   - write some grammars
       - Java grammar
       - TeX (math?)
@@ -23,10 +21,13 @@ Immediately
 ______________________________________________________________________________
 Soon
 
 ______________________________________________________________________________
 Soon
 
-  - substring parsing for better error messages
+  - serialization of parse tables
 
 
-  - clean up the whole Walk situation
+  - "ambiguity modulo dropped fragments"?
+       - can this be checked statically?
+       - eliminated statically?
 
 
+  - substring parsing for better error messages
   - "lift" cases:
       - right now I can only lift the last child in a forest...  begs
         the question of what the right representation for Forests is
   - "lift" cases:
       - right now I can only lift the last child in a forest...  begs
         the question of what the right representation for Forests is
@@ -36,12 +37,9 @@ Soon
   - "Regular Right Part" grammars (NP Chapman, etc)
   - Attribute unification
 
   - "Regular Right Part" grammars (NP Chapman, etc)
   - Attribute unification
 
-  - serialization of parse tables
   - inference of rejections for literals
   - "prefer whitespace higher up" (?)
   - inference of rejections for literals
   - "prefer whitespace higher up" (?)
-  - "ambiguity modulo dropped fragments"?
-       - can this be checked statically?
-       - eliminated statically?
+
 
 ______________________________________________________________________________
 Later
 
 ______________________________________________________________________________
 Later
index 22ef52e..380d09b 100644 (file)
@@ -85,7 +85,7 @@ abstract class Walk<T> {
         public Topology<Tok> walkAtom(Atom r)          { cs = cs.union(r); return cs; }
     }
 
         public Topology<Tok> walkAtom(Atom r)          { cs = cs.union(r); return cs; }
     }
 
-    class First<Tok extends Token> extends WalkTokenSet<Tok> {
+    static class First<Tok extends Token> extends WalkTokenSet<Tok> {
         public First(Topology<Tok> cs, Walk.Cache cache) { super(cs, cache); }
         public Topology<Tok> sequence(Sequence seq) {
             for(Position p = seq.firstp(); p!=null && !p.isLast(); p = p.next()) {
         public First(Topology<Tok> cs, Walk.Cache cache) { super(cs, cache); }
         public Topology<Tok> sequence(Sequence seq) {
             for(Position p = seq.firstp(); p!=null && !p.isLast(); p = p.next()) {
@@ -129,7 +129,7 @@ abstract class Walk<T> {
                 Sequence a = (Sequence)x;
                 Position mp = null;
                 for(Position pos = a.firstp(); pos != null && !pos.isLast(); pos = pos.next()) {
                 Sequence a = (Sequence)x;
                 Position mp = null;
                 for(Position pos = a.firstp(); pos != null && !pos.isLast(); pos = pos.next()) {
-                    if (matched) cs = cs.union(new First<Tok>(cs.empty(), c).walk(pos.element()));
+                    if (matched) cs = cs.union(c.first(pos.element(), cs.empty()));
                     if (pos.isLast()) { matched = (matched && pos.element().possiblyEpsilon(c)); continue; }
                     boolean good = false;
                     if (e instanceof Atom) {
                     if (pos.isLast()) { matched = (matched && pos.element().possiblyEpsilon(c)); continue; }
                     boolean good = false;
                     if (e instanceof Atom) {
@@ -172,5 +172,8 @@ abstract class Walk<T> {
         public HashMap<Element,Topology> follow = new HashMap<Element,Topology>();
         public HashMapBag<Element,Element>  ys = new HashMapBag<Element,Element>();
         public HashMap<Element,Topology> atoms = new HashMap<Element,Topology>();
         public HashMap<Element,Topology> follow = new HashMap<Element,Topology>();
         public HashMapBag<Element,Element>  ys = new HashMapBag<Element,Element>();
         public HashMap<Element,Topology> atoms = new HashMap<Element,Topology>();
+        public <Tok extends Token> Topology<Tok> first(Element e, Topology<Tok> empty) {
+            return new Walk.First<Tok>(empty, this).walk(e);
+        }
     }
 }
     }
 }
index 8fd9c65..7626c55 100644 (file)
@@ -328,17 +328,15 @@ testcase {
 
 testcase {
     input "abc                         ";
 
 testcase {
     input "abc                         ";
-    output "";
 
     s   ::= q " "* => s
     q   ::= [a-z] [a-z] [a-z] => a3
 
     s   ::= q " "* => s
     q   ::= [a-z] [a-z] [a-z] => a3
-//         &~ "a" ~[]*
          &~ ~[] "b" ~[]*
 }
 
 testcase {
     input "abc                         ";
          &~ ~[] "b" ~[]*
 }
 
 testcase {
     input "abc                         ";
-    output "";
+    output "s:{a b c}";
 
 
-    s   ::= [b-z] [a-z] [a-z] " "* => s
+    s   ::= [a-z] [a-z] [a-z] " "* => s
 }
 }