Revised ast script with semantics for If etc.

Termination proof currently broken.