arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1112.3784cs.PL
收藏

使用约束处理规则为Q函数式语言提供静态类型分析

Using Constraint Handling Rules to Provide Static Type Analysis for the Q Functional Language

János Csorba, Zsolt Zombori, Péter Szeredi

摘要:

我们描述了一个应用程序的Prolog:一个类型检查工具的Q函数式语言。Q是一种简洁的向量处理语言,是APL的后代,它越来越受欢迎,特别是在金融应用中。Q是一种动态类型语言,很像Prolog。使用静态类型扩展Q提高了程序的可读性和程序员的生产力,因为类型错误是在编译时被工具发现的,而不是通过调试程序执行。类型检查器使用由Prolog约束处理规则处理的约束。在分析过程中,我们为每个程序表达式确定可能的类型值,并检测不一致性。由于Q的大多数内置函数名都是重载的,即它们的含义取决于参数类型,因此必须实现一个相当复杂的约束系统。

英文摘要:

We describe an application of Prolog: a type checking tool for the Q functional language. Q is a terse vector processing language, a descendant of APL, which is getting more and more popular, especially in financial applications. Q is a dynamically typed language, much like Prolog. Extending Q with static typing improves both the readability of programs and programmer productivity, as type errors are discovered by the tool at compile time, rather than through debugging the program execution. The type checker uses constraints that are handled by Prolog Constraint Handling Rules. During the analysis, we determine the possible type values for each program expression and detect inconsistencies. As most built-in function names of Q are overloaded, i.e. their meaning depends on the argument types, a quite complex system of constraints had to be implemented.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑