Expression tree building and dimension checking.