Checking Types on Arrays, Method Calls, and Structure Accesses
This is the second of two chapters regarding type checking. The previous chapter introduced type checking for built-in atomic types. In comparison, this chapter will cover more complex type-checking operations.
This chapter will show you how to perform type checks for the arrays, parameters, and return types of method calls in the Jzero subset of Java. Additionally, it covers the type checking of structured types such as classes.
In this chapter, we will cover the following main topics:
- Type-checking arrays
- Checking method calls
- Checking structured type accesses
By the end of the chapter, you will be able to write more sophisticated tree traversals to check types that themselves contain one or more other types. Being able to support such composite types in your programming language is necessary for you to go beyond toy programming languages and into the realm of languages that are...