Wrote a master function to parse a whole program