Sweep uses the C interfaces of both SWI-Prolog and Emacs Lisp to create a dynamically loaded Emacs module that contains the SWI-Prolog runtime. As such, Sweep has parts written in C, in Prolog and in Emacs Lisp.
The different parts of Sweep are structured as follows:
sweep-module. This module is linked against the
SWI-Prolog runtime library (libswipl) and exposes a subset of
the SWI-Prolog C interface to Emacs in the form of Elisp functions
(see Querying Prolog). Notably, sweep-module is
responsible for translating Elisp objects to Prolog terms and vice
versa.
sweep-module to provide user-facing commands and functionality.
It is also responsible for loading sweep-module the first time
you do something that involves interacting with Prolog.
sweep) which is by default arranged by sweeprolog.el to
be loaded when the embedded Prolog runtime is initialized. It
contains predicates that sweeprolog.el invokes through
sweep-module to facilitate its different commands.