Static Type Checking for the Q Functional Language in Prolog

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

Thumbnail PDF


  • Filesize: 458 kB
  • 11 pages

Document Identifiers

Author Details

Zsolt Zombori
János Csorba
Péter Szeredi

Cite AsGet BibTex

Zsolt Zombori, János Csorba, and Péter Szeredi. Static Type Checking for the Q Functional Language in Prolog. In Technical Communications of the 27th International Conference on Logic Programming (ICLP'11). Leibniz International Proceedings in Informatics (LIPIcs), Volume 11, pp. 62-72, Schloss Dagstuhl – Leibniz-Zentrum für Informatik (2011)


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. We designed a type description syntax for Q and implemented a parser for both the Q language and its type extension. We then implemented a type checking algorithm using constraints. 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. Prolog proved to be an ideal implementation language for the task at hand. We used Definite Clause Grammars for parsing and Constraint Handling Rules for the type checking algorithm. In the paper we describe the main problems solved and the experiences gained in the development of the type checking tool.
  • logic programming
  • types
  • static type checking
  • constraints
  • CHR
  • DCG


  • Access Statistics
  • Total Accesses (updated on a weekly basis)
    PDF Downloads