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();
}
}
- 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))