We study HMG(X), an extension of the constraint-basedtype system HM(X) with deep pattern matching, polymorphic recursion, and guarded algebraic data types. Guarded algebraic data types subsume the concepts known in t...
详细信息
We study HMG(X), an extension of the constraint-basedtype system HM(X) with deep pattern matching, polymorphic recursion, and guarded algebraic data types. Guarded algebraic data types subsume the concepts known in the literature as indexed types, guarded recursive datatype constructors, (first-class) phantom types, and equality qualified types, and are closely related to inductive types. Their characteristic property is to allow every branch of a case construct to be typechecked under different assumptions about the type variables in scope. We prove that HMG( X) is sound and that, provided recursive definitions carry a type annotation, typeinference can be reduced to constraint solving. constraint solving is decidable, at least for some instances of X, but prohibitively expensive. Effective typeinference for guarded algebraic data types is left as an issue for future research.
Compilers for languages with typeinference algorithms often produce confusing type error messages and give a single error location which is sometimes far away from the real location of the error. Attempts at solving ...
详细信息
Compilers for languages with typeinference algorithms often produce confusing type error messages and give a single error location which is sometimes far away from the real location of the error. Attempts at solving this problem often (1) fail to include the multiple program points which make up the type error;(2) report tree fragments which do not correspond to any place in the user program;and (3) give incorrect type information/diagnosis which can be highly confusing. We present Skalpel, a type error slicing tool which solves these problems by giving the programmer all and only the information involved with a type error to significantly aid in diagnosis and repair of type errors. Skalpel relies on a simple and general constraint system, a sophisticated constraint generator which is linear in program size, and a constraint solver which is terminating. Skalpel's constraint system can elegantly and efficiently handle intricate features such as SML's open. We also show that the Skalpel tool is general enough to deal not only with one source code file and one single error, but highlights all and only the possible locations of the error(s) in all affected files and produces all the culprit multiple program slices. (C) 2016 Elsevier Ltd. All rights reserved.
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...
详细信息
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 domain-specific 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.
We present a constraint system OF of feature trees that is appropriate to specify and implement typeinference for first-class messages. OF extends traditional systems of feature constraints by a selection constraint ...
详细信息
ISBN:
(纸本)3540653880
We present a constraint system OF of feature trees that is appropriate to specify and implement typeinference for first-class messages. OF extends traditional systems of feature constraints by a selection constraint x(y)z "by first-class feature tree" y, in contrast to the standard selection constraint x[f]y "by fixed feature" f. We investigate the satisfiability problem of OF and show that it can be solved in polynomial time, and even in quadratic time in an important special case. We compare OF with Treinen's constraint system EF of feature constraints with first-class features, which has an NP-complete satisfiability problem. This comparison yields that the satisfiability problem for OF with negation is NP-hard. based on OF we give a simple account of typeinference for first-class messages in the spirit of Nishimura's recent proposal, and we show that it has polynomial time complexity: We also highlight an immediate extension,that is desirable but makes typeinference NP-hard.
We propose a conservative extension of HM(X), a generic constraint-based type inference framework, with bounded existential (a.k.a. abstract) and universal (a.k.a. polymorphic) data-types. In the first part of the art...
详细信息
ISBN:
(纸本)9781581137569
We propose a conservative extension of HM(X), a generic constraint-based type inference framework, with bounded existential (a.k.a. abstract) and universal (a.k.a. polymorphic) data-types. In the first part of the article, which remains abstract of the type and constraint language (i.e. the logic X), we introduce the type system, prove its safety and define a typeinference algorithm which computes principal typing judgments. In the second part, we propose a realistic constraint solving algorithm for the case of structural subtyping, which handles the non-standard construct of the constraint language generated by typeinference: a form of bounded universal quantification.
We present a constraint system, OF, of feature trees that is appropriate to specify and implement typeinference for first-class messages. OF extends traditional systems of feature constraints by a selection constrain...
详细信息
We present a constraint system, OF, of feature trees that is appropriate to specify and implement typeinference for first-class messages. OF extends traditional systems of feature constraints by a selection constraint x z, "by first-class feature tree" y, which is in contrast to the standard selection constraint x[f]y, "by fixed feature" f. We investigate the satisfiability problem of OF and show that it can be solved in polynomial time, and even in quadratic time if the number of features is bounded. We compare OF with Treinen's system EF of feature constraints with first-class features, which has an NP-complete satisfiability problem. This comparison yields that the satisfiability problem for OF with negation is NP-hard. Further we obtain NP-completeness, for a specific subclass of OF with negation that is useful for a related typeinference problem. based on OF we give a simple account of typeinference for first-class messages in the spirit of Nishimura's recent proposal, and we show that it has polynomial time complexity: We also highlight an immediate extension of this type system that appears to be desirable but makes typeinference NP-complete.
暂无评论