In this chapter, we presented type checking techniques that are typical for a DSL with object-oriented features. A small Java-like language was introduced to demonstrate how to parse features such as member access and inheritance and how to handle validation of type conformance. The reader might want to experiment with the caching techniques we described in the previous chapter and apply them to the implementation of the DSL.
For further reading concerning type system implementations for Xtext languages, we refer the interested reader to the articles Bettini et al. 2012, Bettini 2013, and Bettini 2016. In these articles, a DSL for implementing type systems for Xtext languages, Xsemantics is also described. Xsemantics is available as an open source project at http://xsemantics.sourceforge.net. There is, however, a crucial aspect that we still have to deal with—correct access to members (fields and methods). In fact, the following selection expression:
e.f
well-typed only if the field...