--- /dev/null
+#ifndef MSP_GL_SL_EVALUATE_H_
+#define MSP_GL_SL_EVALUATE_H_
+
+#include "visitor.h"
+
+namespace Msp {
+namespace GL {
+namespace SL {
+
+class ExpressionEvaluator: public NodeVisitor
+{
+public:
+ typedef std::map<VariableDeclaration *, Expression *> ValueMap;
+
+private:
+ const ValueMap *variable_values;
+ float result;
+ bool result_valid;
+
+public:
+ ExpressionEvaluator();
+ ExpressionEvaluator(const ValueMap &);
+
+ float get_result() const { return result; }
+ bool is_result_valid() const { return result_valid; }
+
+ using NodeVisitor::visit;
+ virtual void visit(Literal &);
+ virtual void visit(ParenthesizedExpression &);
+ virtual void visit(VariableReference &);
+ virtual void visit(UnaryExpression &);
+ virtual void visit(BinaryExpression &);
+};
+
+} // namespace SL
+} // namespace GL
+} // namespace Msp
+
+#endif