added a function which takes a string and parses it to a sequence of tokens