C++ server code

Latest master merged in. We should discuss the layout of the code.
On a related note, SLRE is broken here. It is incorrectly matching regexes (group regexes are being matched as names and that's causing segfaults in the code).