But I'm lost and don't know how write it at all.
I found the code in Sage Language :Help me pleaseWordMorphism('a->aC,b->d,C->de,d->a,e->ab')
t = WordMorphism("a->aC,b->d,C->de,d->a,e->ab")
V = [vector((0,0,1,0,-1)), vector((0,0,1,-1,0))]
S = set(map(tuple, [i*V + j*V for i in [-1,0,1] for j in [-1,0,1]]))
t.rauzy_fractal_plot(n=10000, translate=S, exchange=true)