A framework helping to implement X-machine in Scala