Precursor and result elements may be typed as either one upper case letter, or two letters with the first upper case and the second lower case. Please separate precursors and results with commas, spaces are ignored. You may type a number immediately after an element to indicate more atoms, as in 'H2O'. Fractional atoms are typed as decimal numbers. This version is not aware of electrovalency and will not balance the charge in your reaction.
First we parse user input from the Precursors and Results fields to produce composite tree structures, each being a list of compounds, which are in turn lists of elements. We set the molar quantity of the first result compound to unity, then obtain the molar quantity for each precursor compound according to the amount of each first element present in the first result. Then we set the molar quantities of the remaining results according to how much of each first element is present in the precursors. Finally, we tally up all input elements, subtract the output elements, and produce a list of what is excess or missing.