Semantic analysis

TODO