Functions to Parse a sting for Grammar