[toplevel] Refactor control loop
[toplevel] Refactor control loop

We refactor control loop a bit to make the code more readable:

- the code for unhandled exception is not needed anymore as it cannot
  happen.
- we move the processing of toplevel commands to its own function
- we split away diff-specific functions.

gares/coq,silene/coq,ejgallego/coq,JasonGross/coq,ejgallego/coq,coq/coq,SkySkimmer/coq,JasonGross/coq,Zimmi48/coq,coq/coq,JasonGross/coq,gares/coq,ejgallego/coq,gares/coq,ejgallego/coq,SkySkimmer/coq,Zimmi48/coq,Zimmi48/coq,gares/coq,JasonGross/coq,SkySkimmer/coq,silene/coq,Zimmi48/coq,silene/coq,coq/coq,gares/coq,SkySkimmer/coq,coq/coq