A runtime and code generator for distributed applications