LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
type::Type Class Reference

Abstract a type. More...

#include <type.hh>

Inheritance diagram for type::Type:

Public Member Functions

virtual bool compatible_with (const Type &other) const
 Whether two types are "compatible".
virtual std::ostream & dump (std::ostream &ostr) const =0
 Report this on ostr.
Ctor & dtor.
virtual ~Type ()
 Destroys a Type.
Accessors.
virtual const Typeactual () const
 Return the actual type held by THIS.

Detailed Description

Abstract a type.

Constructor & Destructor Documentation

type::Type::~Type ( )
virtual

Destroys a Type.

Member Function Documentation

const Type & type::Type::actual ( ) const
virtual

Return the actual type held by THIS.

Reimplemented in type::Named.

Referenced by object::TypeChecker::operator()(), and object::DesugarVisitor::recurse_args().

bool type::Type::compatible_with ( const Type other) const
virtual

Whether two types are "compatible".

I.e., whether "a = b", "a <> b", "a := b" are correctly typed with a of type this, and b of type other).

By default two types are compatible (in the sense of "=" and "<>", not wrt an order) only when they are equal.

In the case of assignment, "rec := nil" is valid, but "nil := rec" is not, which suggest that we should have a non commutative assignment specific compatibility check. But since "nil := ..." is incorrect syntactically, that is not needed.

Reimplemented in type::Named, and type::Nil.

virtual std::ostream& type::Type::dump ( std::ostream &  ostr) const
pure virtual

Report this on ostr.

Implemented in type::Named, type::Function, and type::Nil.


The documentation for this class was generated from the following files: