rename

File rename.str
Author unknown
Since unknown

Renaming of bound variables is determined by the shape ofvariables and binding constructs. Three generic strategiesare defined that cater for different complexities of bindingconstructs.

Variable binding constructs protect variables from clashingwith variables in other parts of a program when their namesare the same. To prevent the introduction of name clashesduring program transformation it can be useful to give all variable bindings a unique name. This module defines threegeneric strategies for bound variable renaming all based onthe same idea, but dealing with increasingly complex variablebinding models.

Renaming depends \emph{only} on the shape of variable bindingsand variable occurences. Other language constructs are irrelevant.

In the generic strategies the following assumptions aboutbinding constructs are made: (1)There is a subtree that covers the scope in which thevariables are bound. (2) variables are atomic, i.e., do notcontain subterms that arevariables or binding constructs.

Approach: indicate shape of variable occurences and variablebinders




Statistics


General
Lines of code 85
Stratego
Module number 1 (100% documented)
Constructor number 0
Overlay number 0
Strategy number 3 (66% documented)
Rule number 5 (0% documented)
DynamicRule number 0



Strategy summary


rename(Strategy isvar, Strategy bndvars) renaming bound variables assuming that variables are bound in all subterms of a binding construct variable declarations in binding constructs are assumed to have the same shape as variable uses rename.str
rename(Strategy isvar, Strategy bndvars, Strategy boundin) The strategy \verb|rename(isvar, mkvar, bnd)| renames all bound variables in a term to fresh variables; rename.str
rename(Strategy isvar, Strategy bndvars, Strategy boundin, Strategy paste) n/a rename.str

Rule summary


DistBinding(Strategy s) n/a rename.str
DistBinding(Strategy s, Strategy boundin) n/a rename.str
RnBinding(Strategy bndvrs) n/a rename.str
RnBinding(Strategy bndvrs, Strategy paste) n/a rename.str
RnVar(Strategy isvar) n/a rename.str



Strategy details


ATerm rename(Strategy isvar, Strategy bndvars)
File rename.str
Author unknown
Since unknown
 

renaming bound variables assuming that variables are boundin all subterms of a binding constructvariable declarations in binding constructs are assumed tohave the same shape as variable uses



 
ATerm rename(Strategy isvar, Strategy bndvars, Strategy boundin)
File rename.str
Author unknown
Since unknown
 

The strategy \verb|rename(isvar, mkvar, bnd)| renames allbound variables in a term to fresh variables;

Parameters:

isvar: Succeeds if applied to a variablenewvar: Takes a string and builds a variablebnd: Maps a binding construct to the list of bound variables

renaming while making a distinction between subtermsin which the variables are bound or notvariables at binding sites are assumed to havethe same shape as other variable occurences