/** a parser which translates an Input<Token> into a Forest<NodeType> */
public abstract class Parser<Token, NodeType> {
-
protected final Table<Token> pt;
/** create a parser to parse the grammar with start symbol <tt>u</tt> */
loc = input.getLocation();
Token nextToken = input.next();
GSS.Phase next = gss.new Phase<Token>(current, current, nextToken, loc, input.getLocation(), forest);
- if (!helpgc) {
- FileOutputStream fos = new FileOutputStream("out-"+idx+".dot");
- PrintWriter p = new PrintWriter(new OutputStreamWriter(fos));
- GraphViz gv = new GraphViz();
- for(Object n : next)
- ((Node)n).toGraphViz(gv);
- gv.dump(p);
- p.flush();
- p.close();
- }
+
+ /*
+ FileOutputStream fos = new FileOutputStream("out-"+idx+".dot");
+ PrintWriter p = new PrintWriter(new OutputStreamWriter(fos));
+ GraphViz gv = new GraphViz();
+ for(Object n : current)
+ ((Node)n).toGraphViz(gv);
+ gv.dump(p);
+ p.flush();
+ p.close();
+ */
+
count = next.size();
if (current.isDone()) return (Forest<NodeType>)gss.finalResult;
current = next;
sb.append(" reduce \""+
new edu.berkeley.sbp.chr.CharTopology((IntegerTopology<Character>)t)+"\" => " +
state.reductions.getAll(t) + "\n");
+ for(Sequence s : state.gotoSetNonTerminals.keySet())
+ sb.append(" goto "+state.gotoSetNonTerminals.get(s)+" from " + s + "\n");
}
return sb.toString();
}
walk(start0, all_elements);
for(SequenceOrElement e : all_elements)
cache.ys.addAll(e, new Walk.YieldSet(e, cache).walk());
+ for(SequenceOrElement e : all_elements)
+ cache.ys2.addAll(e, new Walk.YieldSet2(e, cache).walk());
HashSet<Position> hp = new HashSet<Position>();
reachable(start0, hp);
for(Position p : hs) {
Element e = p.element();
if (e==null) continue;
- for(SequenceOrElement y : cache.ys.getAll(e)) {
+ for(SequenceOrElement y : cache.ys2.getAll(e)) {
+ //System.out.println(e + " yields " + y);
HashSet<Position> hp = new HashSet<Position>();
reachable(p.next(), hp);
move.addAll(y, hp);