initial implementation of the type checker