first ugly draft implementation of register machine