Class to parse an input string and calculate its value.