get_formula_elements function

Extract structured elements from a model formula