Parser parser = new Parser();
try {
List<Module> modules = new List<Module>();
for(String src : srcs)
modules.add((Module)parser.parse(new Lexer(new StringReader(src))));
Program prog = new Program(modules);
prog.namecheck();
if(!prog.hasErrors()) prog.typecheck();
if(succeed) {
if(prog.hasErrors()) {
StringBuffer errors = new StringBuffer();
for(CompilerError err : prog.getErrors())
errors.append("\n" + err);
fail("Program was expected to pass semantic checks, but the following " +
"errors were reported:" + errors);
}
} else if(!prog.hasErrors()) {
fail("Program was expected to fail semantic checks, but passed.");
}
} catch (Throwable e) {
if(e instanceof AssertionError) {
throw (AssertionError)e;