Validator

Here is support for a language validator, to detect some errors at function creation time.  I've also added more test cases to see the effect.

The original code already contained a "validate" parameter that was never used.  I have moved some things around to make the validation job more separate from the caching etc. at execution time.