  We present a categorical formalism for context-free languages with morphisms
given by correspondences obtained from rational transductions. We show that
D0L-systems are a special case of the correspondences that define morphisms in
this category. We construct a functorial mapping to aperiodic spin chains. We
then generalize this construction to a class of mildly context sensitive
grammars, the multiple-context-free grammars (MCFG), with a similar functorial
mapping to spin systems in higher dimensions, with Boltzmann weights describing
interacting spins on vertices of hypercubes. We show that a particular
motivating example for this general construction is provided by the Korepin
completely integrable model on the icosahedral quasicrystal, which we construct
as the spin system associated to a multiple-context-free grammar describing the
geometry of the Ammann planes quasilattice. We review the main properties of
this spin system, including solvability, bulk free energy, and criticality,
based on results of Baxter and the known relation to the Zamolodchikov
tetrahedron equation. We show that the latter has a generalization for the
Boltzmannweights on hypercubes of the spin systems associated to more general
MCFGs in terms of two dual cubulations of the n-simplex. We formulate analogous
questions about bulk free energy and criticality for our construction of spin
systems.
