Summary

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.

There is however a crucial aspect that we still have to deal with: correct access to members (fields and methods). In fact, the selection expression

e.f 

is well-typed only if the field f is declared in the class of e (similarly for methods) or in any superclass of the class of e. If you perform some experiments, you will note that at the moment, you can access members which are not declared in the class of the receiver expression, and that you cannot access all the ...

Get Implementing Domain-Specific Languages with Xtext and Xtend now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.