#2685: Refactored calculation of minimum expression length and depth into an separate class. Removed separate initialization code for the grammar caches in the ctor.