  This paper explains how any nondeterministic automaton for a regular language
$L$ gives rise to a one-dimensional oriented Topological Quantum Field Theory
(TQFT) with inner endpoints and zero-dimensional defects labelled by letters of
the alphabet for $L$. The TQFT is defined over the Boolean semiring
$\mathbb{B}$. Different automata for a fixed language $L$ produce TQFTs that
differ by their values on decorated circles, while the values on decorated
intervals are described by the language $L$. The language $L$ and the TQFT
associated to an automaton can be given a path integral interpretation.
  In this TQFT the state space of a one-point 0-manifold is a free module over
$\mathbb{B}$ with the basis of states of the automaton. Replacing a free module
by a finite projective $\mathbb{B}$-module $P$ allows to generalize automata
and this type of TQFT to a structure where defects act on open subsets of a
finite topological space. Intersection of open subsets induces a multiplication
on $P$ allowing to extend the TQFT to a TQFT for one-dimensional foams
(oriented graphs with defects modulo a suitable equivalence relation).
  A linear version of these constructions is also explained, with the Boolean
semiring replaced by a commutative ring.
