+bool Compiler::validate(Stage &stage)
+{
+ TypeValidator().apply(stage);
+ DeclarationValidator().apply(stage);
+ ReferenceValidator().apply(stage);
+ ExpressionValidator().apply(stage);
+
+ for(vector<Diagnostic>::const_iterator i=stage.diagnostics.begin(); i!=stage.diagnostics.end(); ++i)
+ if(i->severity==Diagnostic::ERR)
+ return false;
+
+ return true;
+}
+
+Compiler::OptimizeResult Compiler::optimize(Stage &stage)