...
【24h】

Practical SMT-Based Type Error Localization

机译:实用的基于SMT的类型错误定位

获取原文
获取原文并翻译 | 示例

摘要

Compilers for statically typed functional programming languages are notorious for generating confusing type error messages. When the compiler detects a type error, it typically reports the program location where the type checking failed as the source of the error. Since other error sources are not even considered, the actual root cause is often missed. A more adequate approach is to consider all possible error sources and report the most useful one subject to some usefulness criterion. In our previous work, we showed that this approach can be formulated as an optimization problem related to satisfiability modulo theories (SMT). This formulation cleanly separates the heuristic nature of usefulness criteria from the underlying search problem. Unfortunately, algorithms that search for an optimal error source cannot directly use principal types which are crucial for dealing with the exponential-time complexity of the decision problem of polymorphic type checking. In this paper, we present a new algorithm that efficiently finds an optimal error source in a given ill-typed program. Our algorithm uses an improved SMT encoding to cope with the high complexity of polymorphic typing by iteratively expanding the typing constraints from which principal types are derived. The algorithm preserves the clean separation between the heuristics and the actual search. We have implemented our algorithm for OCaml. In our experimental evaluation, we found that the algorithm reduces the running times for optimal type error localization from minutes to seconds and scales better than previous localization algorithms.
机译:静态类型的功能编程语言的编译器因生成令人困惑的类型错误消息而臭名昭著。当编译器检测到类型错误时,通常会报告类型检查失败的程序位置作为错误源。由于甚至没有考虑其他错误源,因此常常会遗漏实际的根本原因。一种更适当的方法是考虑所有可能的错误源,并根据某些有用性标准报告最有用的一种。在我们以前的工作中,我们证明了该方法可以表述为与可满足性模理论(SMT)有关的优化问题。这种表述将有用性标准的启发式性质与潜在的搜索问题完全分开。不幸的是,搜索最佳错误源的算法不能直接使用主体类型,而主体类型对于处理多态类型检查的决策问题的指数时间复杂性至关重要。在本文中,我们提出了一种新算法,可以在给定的错误类型程序中有效地找到最佳错误源。我们的算法使用改进的SMT编码,通过迭代扩展派生主体类型的类型约束来应对多态类型的高复杂性。该算法保留了启发式搜索与实际搜索之间的清晰分隔。我们已经为OCaml实现了算法。在我们的实验评估中,我们发现该算法将最佳类型错误定位的运行时间从几分钟减少到了几秒钟,并且扩展性比以前的定位算法更好。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号