A compiler architecture for domain-specific type error diagnosis

Publication date

2019-02-14

Authors

Serrano, AlejandroISNI 0000000434518529
Hage, JurriaanISNI 0000000356203424

Editors

Advisors

Supervisors

Document Type

Article
Open Access logo

License

Abstract

Domain-specific languages (DSLs) permeate current programming practices. An important kind of DSLs includes those developed and integrated within a host language, which we call embedded or internal DSLs. Unfortunately, embedded DSLs usually fall short on domainspecific error diagnosis, that is, they do not give control to DSL authors over how errors are reported to the programmer. As a consequence, implementation details of the DSL leak through in error messages, and programmers need to understand the internals of the DSL implementation to fix their code in a productive way. This paper addresses the challenge of building a compiler with integrated support for domain-specific error diagnosis. We assume that the type system is described using a constraint-based approach, and constraint solving is specified using rewrite rules. Domain information can then be injected at constraint gathering time via type rules, during constraint solving via specialized rules and axioms, and finally at blaming and reparation time via transformations. Furthermore, we define error contexts as a way to control the order in which solving and blaming proceeds. We engineer domain-specific error diagnosis in such a way that the compiler can also reuse the techniques for improving general error diagnosis.

Keywords

domain-specific languages, type error diagnosis, constraint-based type inference

Citation

Serrano, A & Hage, J 2019, 'A compiler architecture for domain-specific type error diagnosis', Open Computer Science, vol. 9, no. 1, pp. 33-51. https://doi.org/10.1515/comp-2019-0002