Implement per-promise parse-tree syntax/semantic check hook

This hook allows to modularize pre-evaluation checks and in particular split out
significant chunks out of policy.c. Further, it allows to move some promise-type
level checks currently being done during evaluation to parse-time.