+void Compiler::resolve(Stage &stage)
+{
+ TypeResolver().apply(stage);
+ // Use the bitwise or to always evaluate both operands
+ while(VariableResolver().apply(stage) |
+ ExpressionResolver().apply(stage)) ;
+ FunctionResolver().apply(stage);
+}
+
+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)