Port Annotations for Prolog
Marija Kulaš · 1999
A concept of annotations for rendering procedural aspects of Prolog is presented. We circumvent the need for a new language: our language is a subset of Standard Prolog and is built around well-known procedural concepts. Still, it is a very powerful language of annotations, compared to related approaches. Annotations describe properties of predicates. Such properties can be pre or post conditions, which must hold true when a predicate is called or exited, respectively. Our concept tanscends pre/post conditions: we introduce two more kinds of annotations, fail and redo annotations, hence incorporating a whole model of Prolog execution into our language. This enables natural rendering of many procedural properties of Prolog which cannot be expressed with only pre/post conditions. There are two more novelties in our approach. First, any annotation can be 'narrowed down' to a subset of calls, via templates and contexts, giving much more flexible and pertinent statements. Notably the novel concept of contexts adds significant expressive power. Second, the annotations are applied via a general kind of matching instead of unification, enabling the use of local variables. We provide many detailed illustrations of the potentials of the approach. All presented examples are actual runs of our system Nope, which is a Prolog module.