Specification of Logic Programming Languages from Reusable Semantic Building Blocks
J.E. Labra Gayo, J.M. Cueva Lovelle, M.C. Luengo Díez, A. Cernuda del Río
In Proc. of the International Workshop on Functional and (Constraint) Logic Programming (WFLP 2001)
, Report No. 2017, University of Kiel
We present a Language Prototyping System that facilitates the modular development of interpreters from independent semantic building blocks. The abstract syntax is modelled as the fixpoint of a pattern functor which can be obtained as the sum of functors. For each functor we define an algebra whose carrier is the computational structure. This structure is obtained as the composition of several monad transformers to a base monad, where each monad transformer adds a new notion of computation. When the abstract syntax is composed from mutually recursive categories, we use many-sorted algebras.
With this approach, the prototype interpreters are automatically obtained as a catamorphism over the defined algebras.
As an example, in this paper, we independently specify an arithmetic evaluator and a simple logic programming language and combine both specifications to obtain a logic programming language with arithmetic capabilities.