A simple pretty-printer for Ciao programs

Author(s): The CLIP Group.

This library module writes out to standard output a clause or a list of clauses.

Usage and interface

Documentation on exports

PREDICATE

Usage:pretty_print(Cls,Flags)

Prints each clause in the list Cls after numbering its variables.

  • The following properties should hold at call time:
    (pretty_print:clauses/1)pretty_print:clauses(Cls)
    (basic_props:list/2)Flags is a list of flags.

PREDICATE

Usage:pretty_print(Cls,Flags,Ds)

Prints each clause in the list Cls after using the corresponding variable names dictionary in Ds to name its variables.

  • The following properties should hold at call time:
    (pretty_print:clauses/1)pretty_print:clauses(Cls)
    (basic_props:list/2)Flags is a list of flags.
    (vndict:varnamedict/1)Ds is a dictionary of variable names.

PREDICATE
No further documentation available for this predicate.

Documentation on internals

REGTYPE
A regular type, defined as follows:
clauses([]).
clauses([_1|_2]) :-
        clause(_1),
        clauses(_2).
clauses(_1) :-
        clause(_1).

REGTYPE
A regular type, defined as follows:
clause(_1) :-
        clterm(_1).
clause((_1,_2)) :-
        clterm(_1),
        term(_2).

REGTYPE
A regular type, defined as follows:
clterm(clause(_1,_2)) :-
        callable(_1),
        body(_2).
clterm(directive(_1)) :-
        body(_1).
clterm((_1:-_2)) :-
        callable(_1),
        body(_2).
clterm(_1) :-
        callable(_1).

REGTYPE
A well formed body, including cge expressions and &-concurrent expressions. The atomic goals may or may not have a key in the form ^(goal:any), and may or may not be module qualified, but if they are it has to be in the form ^(^(moddesc:goal):any).

Usage:body(X)

X is a printable body.

    REGTYPE
    A keyword ask/1 flags whether to output asks or whens and nl/1 whether to separate clauses with a blank line or not.

    Usage:flag(X)

    X is a flag for the pretty-printer.

      Known bugs and planned improvements

      • 2.- If the priority of and operator, &/1 or &/2, is redefined with lower priority than :-/2 or ./1, the written term is incorrect because it does not include parenthesis to make Ciao associate and operator first.