Affiliations: Department of Engineering, University of Ferrara, Via Saragat 1, Ferrara, Italy
Corresponding author: Marco Gavanelli, Department of Engineering University of Ferrara, Via Saragat 1, 44122 Ferrara, Italy. Tel./Fax: +39 0532 974833; E-mail: [email protected].
Note:  A preliminary version of this article was presented informally in .
Abstract: Logic Programming is a programming paradigm widely used for teaching Artificial Intelligence in university courses. Prolog, probably the most popular Logic Programming language, is based on inferences similar to theorem provers, and learning it is propaedeutical for understanding formal specification languages. However, after a first phase in which students learn how specifications can be translated into executable code, a second phase is necessary for engineering the resulting program. In this second phase, having a clear picture of the execution model is crucial. In this paper, SLDNF-Draw, a program that visualizes the SLDNF operational semantics of Prolog, is presented. SLDNF-Draw produces trees in LATEX, the popular typesetting system, so that the generated trees have very high typographic quality and can be embedded in printed documents (e.g., course handouts) as well as in animated presentations. SLDNF Draw is completely written in Prolog, as a meta-interpreter, and does not rely on external imperative languages for the visualization.