Finished implementing the parser.

Function is still untested.