/**
* @author Adam Megacz <megacz@cs.berkeley.edu>
*/
-class Parser {
+public class Parser {
Parser(Fleet fleet) {
+ expect = new ArrayList<Long>();
this.fleet = fleet;
}
CodeBag rootCodeBag = new CodeBag();
baseCodeBag.add(new Instruction.Literal.CodeBagDescriptor(null, rootCodeBag.getFakeAddress(), 1));
walk((Tree<String>)parse(r), rootCodeBag);
- if (fleet instanceof edu.berkeley.fleet.interpreter.Interpreter)
+ if (fleet instanceof edu.berkeley.fleet.slipway.Slipway)
((edu.berkeley.fleet.slipway.Slipway)fleet).dumpFabric(true);
// map from arbitrary identifiers to actual addresses
throw new RuntimeException(e);
}
+ } else if (head.equals("Expect")) {
+ expect.add(Long.parseLong(string(t.child(0))));
+
} else if (head.equals("Memory")) {
if (((edu.berkeley.fleet.interpreter.Interpreter)fleet).mem.length != 0)
throw new RuntimeException("multiple memory directives found");
public boolean equals(Object o) { return this==o; }
}
+ // hideous hack
+ public static ArrayList<Long> expect;
+
}
| Import:: "#import" [A-Za-z_.]++ /ws
| Include:: "#include" ("\"" (~[\"])+ "\"") /ws
| Ship:: "#ship" shipname ":" [0-9A-Za-z_.]++ /ws
+ | Expect:: "#expect" int /ws