From: Markus Triska Date: Thu, 1 Oct 2020 19:15:40 +0000 (+0200) Subject: DOC: Development environment recommendations. X-Git-Tag: v0.9.0~173^2~1^2 X-Git-Url: https://git.sagredo.dev/?a=commitdiff_plain;h=2e295e354ae1e1063b27c0c0eed66c0a6b991a84;p=scryer-prolog.git DOC: Development environment recommendations. --- diff --git a/README.md b/README.md index 12a4874f..cf7c729e 100644 --- a/README.md +++ b/README.md @@ -516,3 +516,35 @@ For example, a sensible starting point for `~/.scryerrc` is: :- use_module(library(dcgs)). :- use_module(library(reif)). ``` + +### Development environment + +To write and edit Prolog programs, we recommend +[GNU Emacs](https://www.gnu.org/software/emacs/) with the +[Prolog mode](https://bruda.ca/emacs/prolog_mode_for_emacs) +maintained by Stefan Bruda. + +Use [ediprolog](https://www.metalevel.at/ediprolog/) to consult +Prolog code and evaluate Prolog queries in arbitrary +Emacs buffers. + +Emacs definitions that show Prolog terms as trees are currently being +developed and discussed in +issue [#697](https://github.com/mthom/scryer-prolog/issues/697), +and we welcome your comments. + +To *debug* Prolog code, we recommend the predicates from +[**`library(debug)`**](src/lib/debug.pl), most notably: + +- `(*)/1` to *"generalize away"* a Prolog goal. Use it to debug + unexpected failures by generalizing your definitions until they + succeed. Simply place `*` in front of a goal to generalize it away. +- `($)/1` to emit a *trace* of the execution, showing when a goal + is invoked, and when it has succeeded. Place `$` in front of a goal + to emit this information for that goal. + +This way of debugging Prolog code has several major benefits, such as: +It stays close to the actual Prolog code under consideration, it does +not need additional tools and formalisms for its application, and +further, it encourages declarative reasoning that can in principle +also be performed automatically.