Correct handling of the price-value flag in formulas
Added sum and value functions. All test validated. Compiler rewrite complete