x -> r in sem.cpp