+bool is_scalar(const BasicTypeDeclaration &);
+bool is_vector_or_matrix(const BasicTypeDeclaration &);
+BasicTypeDeclaration *get_element_type(BasicTypeDeclaration &);
+bool can_convert(const BasicTypeDeclaration &, const BasicTypeDeclaration &);
+
+/** Compares two types for equality. Struct types are compared recursively. */
+class TypeComparer: private NodeVisitor
+{
+private:
+ Node *first;
+ Node *second;
+ unsigned first_tag;
+ bool r_result;
+
+ static unsigned next_tag;
+
+public:
+ TypeComparer();
+
+ bool apply(TypeDeclaration &t1, TypeDeclaration &t2) { compare(t1, t2); return r_result; }
+
+private:
+ void compare(Node &, Node &);
+ template<typename T>
+ T *multi_visit(T &);
+ virtual void visit(Literal &);
+ virtual void visit(VariableReference &);
+ virtual void visit(BasicTypeDeclaration &);
+ virtual void visit(ImageTypeDeclaration &);
+ virtual void visit(StructDeclaration &);
+ virtual void visit(VariableDeclaration &);
+};
+