Parser for chemical fomulas