57 snprintf(name, 256,
"PRIVATISE %p : ", (
CTree*)t);
64 snprintf(name, 256,
"OWNER IS %p : ", (
CTree*)t);
75 if (t->
arity() == 0) {
83 return isNil(v) ? t : v;
104 Tree tbl, size, idx, wrt, content, id, var, body;
117 }
else if (
isSigTable(exp,
id, size, content) ) {
123 }
else if (
isSigGen(exp, content) ) {
126 printf(
"erreur 1 dans computePrivatisation\n");
129 }
else if (
isRec(exp, var, body) ) {
140 int n = exp->
arity();
141 for (
int i = 0; i < n; i++) {
152 Tree tbl, size, idx, wrt, content, oldid;
154 if (
isSigWRTbl(exp, oldid, tbl, idx, wrt) ) {
159 return sigWRTbl(newid, tbl, idx, wrt);
161 }
else if (
isSigTable(exp, oldid, size, content) ) {
165 return sigTable(newid, size, content);
169 printf(
"erreur labelize\n");
Symbol * unique(const char *str)
Returns a new unique symbol of name strxxx.
Tree rec(Tree body)
create a de Bruijn recursive tree
A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches.
const Node & node() const
return the content of the tree
bool isSigGen(Tree t, Tree &x)
Tree privatise(const Tree &t)
bool isSigTable(Tree t, Tree &id, Tree &n, Tree &sig)
static Tree privatisation(const Tree &k, const Tree &t)
bool isSigWRTbl(Tree u, Tree &id, Tree &t, Tree &i, Tree &s)
int arity() const
return the number of branches (subtrees) of a tree
const char * name(Symbol *sym)
Returns the name of a symbol.
static Tree makePrivatisationKey(const Tree &t)
bool isRec(Tree t, Tree &body)
is t a de Bruijn recursive tree
void setProperty(Tree t, Tree key, Tree val)
static Tree makePrivatisationLabel(const Tree &exp)
API to the typing system of signals.
static Tree labelize(const Tree &label, const Tree &exp)
static Tree computePrivatisation(const Tree &k, const Tree &t)
Tree sigWRTbl(Tree id, Tree t, Tree i, Tree s)
Tree sigTable(Tree id, Tree n, Tree sig)
Tree branch(int i) const
return the ith branch (subtree) of a tree
bool getProperty(Tree t, Tree key, Tree &val)