Added comments and rearranged and refactored tokenizer and grammar