Semantic analysis.

WIP.