arXiv.itsnick.co

an independent field guide to 23 million papers from arXiv & OpenAlex — not affiliated with arXiv.org

Computer Science · Artificial Intelligence

An Implementation of Modular Monadic Semantics using Folds and Monadic Folds

Jose Emilio, Jose Emilio Labra Gayo

See on the map

Abstract

Modular monadic semantics can be implemented using folds or catamorphisms over a functor that expresses the abstract syntax of the language. By composing several functors, it is possible to obtain modular interpreters from reusable components. Monadic folds structure programs that process recursively their input and control the side effects of the output they produce. We consider that the semantic specification of a programming language is a natural framework for monadic folds that improves the abstraction level and modularity. In this paper we use folds and monadic folds to develop the modular monadic semantics of a simple language. Introduction Using monads to structure denotational semantics [20] facilitates more modular semantic specifications. While traditional denotational semantics maps terms to values, monadic semantics maps terms to computations where a computation is modelled with a monad. In general, it is not possible to compose two monads to obtain a new monad [13], but ...

More like this