added initial implementation of functions

also includes support for semantic validation of expressions
cbugg: close bug-670