checkpoint harmony
[sbp.git] / src / edu / berkeley / sbp / Parser.java
index 0d04f3f..d04c49f 100644 (file)
@@ -11,15 +11,12 @@ public abstract class Parser<T extends Token, R> {
     private final Table pt;
 
     /** create a parser to parse the grammar with start symbol <tt>u</tt> */
-    protected Parser(Union u)  { this.pt = new Table(u, top()); }
-    protected Parser(Table pt) { this.pt = pt; }
+    protected Parser(Union u, Topology<T> top)  { this.pt = new Table(u, top); }
+    protected Parser(Table pt)                  { this.pt = pt; }
 
     /** implement this method to create the output forest corresponding to a lone shifted input token */
     public abstract Forest<R> shiftedToken(T t, Token.Location loc);
 
-    /** this method must return an empty topology of the input token type */
-    public abstract Topology<T> top();
-
     /** parse <tt>input</tt>, using the table <tt>pt</tt> to drive the parser */
     public Forest<R> parse(Token.Stream<T> input) throws IOException, ParseFailed {
         GSS gss = new GSS();
@@ -244,11 +241,8 @@ public abstract class Parser<T extends Token, R> {
         }
     }
 
-    private static final Forest[] emptyForestArray = new Forest[0];
-
-
     // Helpers //////////////////////////////////////////////////////////////////////////////
-
+    
     private static void reachable(Element e, HashSet<Position> h) {
         if (e instanceof Atom) return;
         for(Sequence s : ((Union)e))