  We propose a way of associating to each finitely generated monoid or
semigroup a formal language, called its loop problem. In the case of a group,
the loop problem is essentially the same as the word problem in the sense of
combinatorial group theory. Like the word problem for groups, the loop problem
is regular if and only if the monoid is finite. We study also the case in which
the loop problem is context-free, showing that a celebrated group-theoretic
result of Muller and Schupp extends to describe completely simple semigroups
with context-free loop problems. We consider also right cancellative monoids,
establishing connections between the loop problem and the structural theory of
these semigroups by showing that the syntactic monoid of the loop problem is
the inverse hull of the monoid.
