Using Constraint Handling Rules to Provide Static Type Analysis for the Q Functional Language
J\'anos Csorba, Zsolt Zombori, P\'eter Szeredi

TL;DR
This paper presents a static type analysis tool for the Q language using Constraint Handling Rules in Prolog, enabling early detection of type errors in a dynamically typed, vector processing language.
Contribution
It introduces a novel approach combining Prolog's Constraint Handling Rules with static type analysis for Q, improving program readability and error detection.
Findings
Type errors are detected at compile time.
The constraint system handles overloaded functions.
The tool enhances programmer productivity in Q.
Abstract
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.
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Software Engineering Research · Advanced Software Engineering Methodologies
