Modularize components previously in parser.js

In preparation for this library becoming a module in a web service that provides validation information, all of the stuff not related to reading an input file and printing output has been factored out of parser.js.