LLMs Struggle with Right-to-Left Code: The Case of q/kdb+

2025-07-09
LLMs Struggle with Right-to-Left Code: The Case of q/kdb+

Large language models (LLMs) face challenges when writing code in q/kdb+, a language with a right-to-left, no-operator-precedence evaluation order. The author demonstrates that LLMs struggle to generate correct code adhering to these rules, often mixing Python and q syntax. The article explores why LLMs find right-to-left coding difficult and proposes Qython as a solution. Qython is a Python-like language that compiles to q, leveraging LLMs' Python expertise to circumvent the difficulties of q's unique syntax. A practical example showcases Qython's effectiveness.

Development