Constraint-based mode analysis of mercury
Constraint-based mode analysis of mercury
复制标题
基于约束的汞模式分析
DOI:
10.1145/571157.571169
复制
发表时间:
2002
影响因子:
2
通讯作者:
Peter James Stuckey
中科院分区:
文献类型:
--
作者:
D. Overton;Z. Somogyi;Peter James Stuckey
Recent logic programming languages, such as Mercury and HAL, require type, mode and determinism declarations for predicates. This information allows the generation of efficient target code and the detection of many errors at compile-time. Unfortunately, mode checking in such languages is difficult. One of the main reasons is that, for each predicate mode declaration, the compiler is required to decide which parts of the procedure bind which variables, and how conjuncts in the predicate definition should be re-ordered to enforce this behaviour. Current mode checking systems limit the possible modes that may be used because they do not keep track of aliasing information, and have only a limited ability to infer modes, since inference does not perform reordering. In this paper we develop a mode inference system for Mercury based on mapping each predicate to a system of Boolean constraints that describe where its variables can be produced. This allows us handle programs that are not supported by the existing system.