- private static void reachable(Element e, HashSet<Position> h) {
- if (e instanceof Atom) return;
- for(Sequence s : ((Union)e))
- reachable(s.firstp(), h);
- }
- private static void reachable(Position p, HashSet<Position> h) {
- if (h.contains(p)) return;
- h.add(p);
- if (p.element() != null) reachable(p.element(), h);
- }
-
- //public Parser( Topology top) { this(new Table( top)); }
- //public Parser(String s, Topology top) { this(new Table(s, top)); }
+ /** 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; }