idp_engine.Annotate¶
Methods to annotate the Abstract Syntax Tree (AST) of an IDP-Z3 program.
- root_set(s)[source]
Recursively finds the root set of a set in the hierarchy.
It goes up the hierarchy until a declared type or a Concept[..] is found.
- Parameters
s (idp_engine.Expression.SetName) –
- Return type
idp_engine.Expression.SetName
- rename_args(self, subs)[source]
replace old variables by new variables (ignoring arguments in the head before the it
- Parameters
self (Rule) –
subs (dict[str, Expression]) –
- base_type(exprs, bases=None)[source]
Checks or determines the (sub)types of the expressions in exprs.
Raises an error if the (sub)type of an expression is not in bases. Raises an error if the expressions have incompatible (sub)types. Returns None if exprs is empty.
A mix of Int and Real (or Int and Date) is allowed.
- Parameters
exprs (List[idp_engine.Expression.Expression]) –
bases (Optional[List[idp_engine.Expression.SetName]]) –
- Return type
Optional[idp_engine.Expression.SetName]