From e5d6a50df43fa50f217b30b0959a1d39f65b621c Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 15 Jan 2006 03:10:01 -0500 Subject: [PATCH] checkpoint darcs-hash:20060115081001-5007d-1ef9071d36d02f216091f2340d73129306cbed36.gz --- TODO | 26 ++++++++++++-------------- src/edu/berkeley/sbp/Walk.java | 7 +++++-- tests/regression.tc | 6 ++---- 3 files changed, 19 insertions(+), 20 deletions(-) diff --git a/TODO b/TODO index 1ad1494..fb89b52 100644 --- a/TODO +++ b/TODO @@ -1,18 +1,16 @@ _____________________________________________________________________________ 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 + +______________________________________________________________________________ +v1.1 + + - finalize metagrammar and rdp-op's - write some grammars - Java grammar - TeX (math?) @@ -23,10 +21,13 @@ Immediately ______________________________________________________________________________ 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 @@ -36,12 +37,9 @@ Soon - "Regular Right Part" grammars (NP Chapman, etc) - Attribute unification - - serialization of parse tables - inference of rejections for literals - "prefer whitespace higher up" (?) - - "ambiguity modulo dropped fragments"? - - can this be checked statically? - - eliminated statically? + ______________________________________________________________________________ Later diff --git a/src/edu/berkeley/sbp/Walk.java b/src/edu/berkeley/sbp/Walk.java index 22ef52e..380d09b 100644 --- a/src/edu/berkeley/sbp/Walk.java +++ b/src/edu/berkeley/sbp/Walk.java @@ -85,7 +85,7 @@ abstract class Walk { public Topology walkAtom(Atom r) { cs = cs.union(r); return cs; } } - class First extends WalkTokenSet { + static class First extends WalkTokenSet { public First(Topology cs, Walk.Cache cache) { super(cs, cache); } public Topology sequence(Sequence seq) { for(Position p = seq.firstp(); p!=null && !p.isLast(); p = p.next()) { @@ -129,7 +129,7 @@ abstract class Walk { 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(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) { @@ -172,5 +172,8 @@ abstract class Walk { public HashMap follow = new HashMap(); public HashMapBag ys = new HashMapBag(); public HashMap atoms = new HashMap(); + public Topology first(Element e, Topology empty) { + return new Walk.First(empty, this).walk(e); + } } } diff --git a/tests/regression.tc b/tests/regression.tc index 8fd9c65..7626c55 100644 --- a/tests/regression.tc +++ b/tests/regression.tc @@ -328,17 +328,15 @@ testcase { testcase { input "abc "; - output ""; s ::= q " "* => s q ::= [a-z] [a-z] [a-z] => a3 -// &~ "a" ~[]* &~ ~[] "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 } -- 1.7.10.4