projects
/
sbp.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
9b7ce1d
)
checkpoint
author
adam
<adam@megacz.com>
Sun, 16 Jul 2006 07:53:41 +0000
(
03:53
-0400)
committer
adam
<adam@megacz.com>
Sun, 16 Jul 2006 07:53:41 +0000
(
03:53
-0400)
darcs-hash:
20060716075341
-5007d-
f5dffd8569ffb25d2fdf4677916ddc8203a031f1
.gz
TODO
patch
|
blob
|
history
src/edu/berkeley/sbp/Forest.java
patch
|
blob
|
history
src/edu/berkeley/sbp/GSS.java
patch
|
blob
|
history
src/edu/berkeley/sbp/Parser.java
patch
|
blob
|
history
src/edu/berkeley/sbp/Tree.java
patch
|
blob
|
history
src/edu/berkeley/sbp/Union.java
patch
|
blob
|
history
diff --git
a/TODO
b/TODO
index
7186baf
..
d58eb06
100644
(file)
--- a/
TODO
+++ b/
TODO
@@
-2,6
+2,8
@@
_____________________________________________________________________________
Immediately
- do Forest/Tree still need a Region?
Immediately
- do Forest/Tree still need a Region?
+ - reconsider the degree of genericization
+ - GraphViz stuff pollutes the API...
- Forest needs a "manual access" API
- the unwrap bit in Forest makes it really hard to expose an API for forests
- Forest needs a "manual access" API
- the unwrap bit in Forest makes it really hard to expose an API for forests
diff --git
a/src/edu/berkeley/sbp/Forest.java
b/src/edu/berkeley/sbp/Forest.java
index
645850b
..
bd3b46a
100644
(file)
--- a/
src/edu/berkeley/sbp/Forest.java
+++ b/
src/edu/berkeley/sbp/Forest.java
@@
-27,10
+27,9
@@
public abstract class Forest<T> implements GraphViz.ToGraphViz {
abstract void expand(HashSet<Tree<T>> ht, HashSet<Forest<T>> ignore, Tree<T> bogus);
abstract void gather(HashSet<Forest<T>> ignore);
abstract void expand(HashSet<Tree<T>> ht, HashSet<Forest<T>> ignore, Tree<T> bogus);
abstract void gather(HashSet<Forest<T>> ignore);
+ abstract void edges(GraphViz.Node n);
boolean ambiguous() { return false; }
boolean ambiguous() { return false; }
- public abstract void edges(GraphViz.Node n);
-
// One //////////////////////////////////////////////////////////////////////////////
// One //////////////////////////////////////////////////////////////////////////////
diff --git
a/src/edu/berkeley/sbp/GSS.java
b/src/edu/berkeley/sbp/GSS.java
index
f85ec0b
..
9075f41
100644
(file)
--- a/
src/edu/berkeley/sbp/GSS.java
+++ b/
src/edu/berkeley/sbp/GSS.java
@@
-8,17
+8,17
@@
import java.util.*;
import java.lang.reflect.*;
/** implements Tomita's Graph Structured Stack */
import java.lang.reflect.*;
/** implements Tomita's Graph Structured Stack */
-public class GSS {
+class GSS {
- public static int count = 0;
- public static int shifts = 0;
- public static int reductions = 0;
+ static int count = 0;
+ static int shifts = 0;
+ static int reductions = 0;
+ int resets = 0;
+ int waits = 0;
public GSS() { }
private Phase.Node[] reducing_list = null;
public GSS() { }
private Phase.Node[] reducing_list = null;
- public int resets = 0;
- public int waits = 0;
// FIXME: right now, these are the performance bottleneck
HashMapBag<Sequence,Phase.Waiting> waiting = new HashMapBag<Sequence,Phase.Waiting>();
// FIXME: right now, these are the performance bottleneck
HashMapBag<Sequence,Phase.Waiting> waiting = new HashMapBag<Sequence,Phase.Waiting>();
@@
-27,7
+27,7
@@
public class GSS {
HashMapBag<Integer,Sequence> expected = new HashMapBag<Integer,Sequence>();
/** FIXME */
HashMapBag<Integer,Sequence> expected = new HashMapBag<Integer,Sequence>();
/** FIXME */
- public Forest.Many finalResult;
+ Forest.Many finalResult;
/** corresponds to a positions <i>between tokens</i> the input stream; same as Tomita's U_i's */
class Phase<Tok> implements Invokable<State, Forest, Phase<Tok>.Node>, IntegerMappable, GraphViz.ToGraphViz, Iterable<Phase.Node> {
/** corresponds to a positions <i>between tokens</i> the input stream; same as Tomita's U_i's */
class Phase<Tok> implements Invokable<State, Forest, Phase<Tok>.Node>, IntegerMappable, GraphViz.ToGraphViz, Iterable<Phase.Node> {
diff --git
a/src/edu/berkeley/sbp/Parser.java
b/src/edu/berkeley/sbp/Parser.java
index
300ff27
..
744b7c0
100644
(file)
--- a/
src/edu/berkeley/sbp/Parser.java
+++ b/
src/edu/berkeley/sbp/Parser.java
@@
-15,9
+15,9
@@
public abstract class Parser<Tok, Result> {
protected Parser(Table<Tok> pt) { this.pt = pt; }
/** implement this method to create the output forest corresponding to a lone shifted input token */
protected Parser(Table<Tok> pt) { this.pt = pt; }
/** implement this method to create the output forest corresponding to a lone shifted input token */
- public abstract Forest<Result> shiftToken(Input.Location oldloc, Tok t, Input.Location newloc);
+ protected abstract Forest<Result> shiftToken(Input.Location oldloc, Tok t, Input.Location newloc);
- public boolean helpgc = true;
+ boolean helpgc = true;
public String toString() { return pt.toString(); }
public String toString() { return pt.toString(); }
diff --git
a/src/edu/berkeley/sbp/Tree.java
b/src/edu/berkeley/sbp/Tree.java
index
2f72029
..
2bfd187
100644
(file)
--- a/
src/edu/berkeley/sbp/Tree.java
+++ b/
src/edu/berkeley/sbp/Tree.java
@@
-92,5
+92,4
@@
public class Tree<T>
public boolean isTransparent() { return false; }
public boolean isHidden() { return false; }
public boolean isTransparent() { return false; }
public boolean isHidden() { return false; }
-
}
}
diff --git
a/src/edu/berkeley/sbp/Union.java
b/src/edu/berkeley/sbp/Union.java
index
6cba89c
..
99ef42b
100644
(file)
--- a/
src/edu/berkeley/sbp/Union.java
+++ b/
src/edu/berkeley/sbp/Union.java
@@
-10,6
+10,10
@@
import java.lang.ref.*;
/** an element which can produce one of several alternatives */
public class Union extends Element implements Iterable<Sequence> {
/** an element which can produce one of several alternatives */
public class Union extends Element implements Iterable<Sequence> {
+ private final String name;
+ private final boolean synthetic;
+ private final List<Sequence> alternatives = new ArrayList<Sequence>();
+
/**
* Since every cycle in a non-degenerate grammar contains at
* least one Union, every instance of this class must be able to
/**
* Since every cycle in a non-degenerate grammar contains at
* least one Union, every instance of this class must be able to
@@
-20,16
+24,12
@@
public class Union extends Element implements Iterable<Sequence> {
* @param synthetic if true, this Union's "long form" is "obvious" and should not be displayed when printing the grammar
*/
public Union() { this(null, false); }
* @param synthetic if true, this Union's "long form" is "obvious" and should not be displayed when printing the grammar
*/
public Union() { this(null, false); }
- public Union(String shortForm) { this(shortForm, false); }
- public Union(String shortForm, boolean synthetic) {
- this.shortForm = shortForm;
+ public Union(String name) { this(name, false); }
+ public Union(String name, boolean synthetic) {
+ this.name = name;
this.synthetic = synthetic;
}
this.synthetic = synthetic;
}
- final String shortForm;
- final boolean synthetic;
- private final List<Sequence> alternatives = new ArrayList<Sequence>();
-
public Iterator<Sequence> iterator() { return alternatives.iterator(); }
public boolean contains(Sequence s) { return alternatives.contains(s); }
public Iterator<Sequence> iterator() { return alternatives.iterator(); }
public boolean contains(Sequence s) { return alternatives.contains(s); }
@@
-64,11
+64,11
@@
public class Union extends Element implements Iterable<Sequence> {
// Display //////////////////////////////////////////////////////////////////////////////
public String getName() {
// Display //////////////////////////////////////////////////////////////////////////////
public String getName() {
- if (shortForm != null) return shortForm;
+ if (name != null) return name;
return "(anon_union)";
}
public String toString() {
return "(anon_union)";
}
public String toString() {
- if (shortForm != null) return shortForm;
+ if (name != null) return name;
StringBuffer sb = new StringBuffer();
sb.append("(");
bodyToString(sb, "", " | ");
StringBuffer sb = new StringBuffer();
sb.append("(");
bodyToString(sb, "", " | ");