Go to the first, previous, next, last section, table of contents.


Code translation utilities

Author(s): Angel Fernandez Pineda.

Version: 1.11#222 (2004/5/24, 13:8:7 CEST)

Version of last change: 1.11#16 (2003/4/8, 4:35:48 CEST)

This library offers a general way to perform clause body expansions. Goal, fact and spec translation predicates are authomatically called when needed, while this utility navigates through the meta-argument specification of the body itself. All predicates within this library must be called at second-pass expansions, since it uses information stored at c_itf library.

Usage and interface (expansion_tools)

Documentation on exports (expansion_tools)

PREDICATE: imports_meta_pred/3:

Macro provided in order to know meta-predicate specifications accessible from a module.

Usage: imports_meta_pred(Module, MetaSpec, AccessibleAt)

PREDICATE: body_expander/6:

This predicate is the main translation tool. It navigates through a clause body, when a single goal appears, user-code is called in order to perform a translation. Whether user-code fails to translate the involved goal, it remains the same. Regardless that goal is translated or not, an argument expansion will be performed over all goals if applicable (see arg_expander/6 predicate).

Variable (unknown at compile time) goals will also be attempt to translate.

Meta-predicate with arguments: body_expander(pred(3),pred(3),pred(3),?,?,?).

Usage: body_expander(GoalTrans, FactTrans, SpecTrans, Module, Body, ExpandedBody)

PREDICATE: arg_expander/6:

This predicate is an auxiliary translation tool, which is used by body_expander/6 predicate. It remains exported as a macro. The predicate navigates through the meta-argument specification of a goal. Whether a goal,fact or spec argument appears, user-code is called in order to perform a translation. Whether user-code fails to translate the involved argument, it remains the same. Builtins as ','/2 or ';'/2 are treated as meta-predicates defining goal meta-arguments. When a goal meta-argument is located, body_expander/6 will be called in order to navigate through it. Notice that a goal meta-argument may be unified with another goal defining another meta-argument, so navigation is required. If arguments are not known to arg_expander/6, translation will not occur. This is posible whether goal or qualifing module are variables.

Meta-predicate with arguments: arg_expander(pred(3),pred(3),pred(3),?,?,?).

Usage: arg_expander(GoalTrans, FactTrans, SpecTrans, Module, Goal, ExpandedGoal)

Documentation on internals (expansion_tools)

PROPERTY: expander_pred/1:

Usage: expander_pred(Pred)

Known bugs and planned improvements (expansion_tools)


Go to the first, previous, next, last section, table of contents.