Meta interview question

Give an algorithm to parse a regular expression.