Kihi

Kihi is a concatenative, compositional, functional programming language with a minimal core of only six operations.

Kihi can be tried online and in PLT Redex. Both include a variety of sample programs and the ability to visualise the execution stepwise.

Every function in Kihi takes zero or more inputs and produces zero or more outputs, and functions automatically compose with each other in an arity-neutral way. A Kihi program has no hidden state and can be serialised at any point during execution.

Through term rewriting the six core operations

allow complex functions to be built by composing smaller pieces with clear underlying semantics. User-defined functions compose together automatically so that complex programs can be built without using the low-level operations directly. Further syntax can be layered on top of the core to enable name binding and other convenience features.

Related Publications

The Practice of a Compositional Functional Programming Language. Timothy Jones, Michael Homer. In APLAS, 2018. (bibtex, author copy)

Function composition is a very natural operation, but most language paradigms provide poor support for it. Without linguistic support programmers must work around or manually implement what would be simple compositions. The Kihi language uses only composition, makes all state visible, and reduces to just six core operations. Kihi programs are easily stepped by textual reduction but provide a foundation for compositional design and analysis.


Michael Homer — 2024 e6b1d5c8