A compiler architecture for domain-specific type error diagnosis

Alejandro Serrano, J. Hage

Research output: Contribution to journalArticlepeer-review

4 Citations (Scopus)
77 Downloads (Pure)


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.
Original languageEnglish
Pages (from-to)33-51
Number of pages19
JournalOpen Computer Science
Issue number1
Publication statusPublished - 14 Feb 2019


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


Dive into the research topics of 'A compiler architecture for domain-specific type error diagnosis'. Together they form a unique fingerprint.

Cite this