The language we develop in this chapter is a simplified version of Java, called SmallJava. This language does not aim at being useful in practice and cannot be used to write real programs such as Java. However, SmallJava contains enough language features that will allow us to explore advanced type checking techniques that can also be reused for other DSLs, which have OOP mechanisms such as inheritance and subtyping.
The implementation we see in this chapter will not be complete, since some features of this language, such as correct member access, will be implemented in the next chapter when we introduce the mechanism of local and global scoping. In a Java-like language type checking and scoping are tightly connected and complement each other; for the sake of readability, we will split typing and scoping into two separate chapters.
We will not describe how to write a code generator for SmallJava; we will focus on statically checking SmallJava programs rather than executing them. However...