Bringing Algebraic Hierarchical Decompositions to Concatenative Functional Languages
Attila Egri-Nagy
TL;DR
This work addresses the gap between programming languages and algebraic theory by extending Krohn–Rhodes hierarchical decompositions to the realm of concatenative languages through semigroupoids. It formalizes semigroupoids as typed, associative arrow structures and applies a two-level decomposition (collapse-copy-compress) to language representations, enabling an explicit hierarchical view of program structure. The paper introduces a minimal semigroupoid language with precise typing rules and analyzes how to manage infinity via finite top-level representations, illustrated with a binary-addition example and partial transformation models. By surveying concatenative languages (FORTH, Lisp, Joy, Factor) and outlining a concrete plan for modular language design, it sets a foundation for algebraic analysis of program spaces and design choices with potential benefits for correctness, pedagogy, and language evolution.
Abstract
Programming languages tend to evolve over time to use more and more concepts from theoretical computer science. Still, there is a gap between programming and pure mathematics. Not all theoretical results have realized their promising applications. The algebraic decomposition of finite state automata (Krohn-Rhodes Theory) constructs an emulating hierarchical structure from simpler components for any computing device. These decompositions provide ways to understand and control computational processes, but so far the applications were limited to theoretical investigations. Here, we study how to apply algebraic decompositions to programming languages. We use recent results on generalizing the algebraic theory to the categorical level (from semigroups to semigroupoids) and work with the special class of concatenative functional programming languages. As a first application of semigroupoid decompositions, we start to design a family of programming languages with an explicit semigroupoid representation.
