/* Web Polygraph       http://www.web-polygraph.org/
 * (C) 2003-2006 The Measurement Factory
 * Licensed under the Apache License, Version 2.0 */

#include "pgl/pgl.h"

#include "xstd/gadgets.h"
#include "base/polyVersion.h"
#include "pgl/PglPp.h"
#include "pgl/PglParser.h"
#include "pgl/PglStaticSemx.h"


int main(int argc, char **argv) {
	(void)PolyVersion();
	if (argc < 2) {
		cerr << "usage: " << argv[0] << " <input_file> [include_dir] ..." << 
			endl << xexit;
	}

	for (int i = 2; i < argc; ++i)
		PglPp::TheDirs.append(new String(argv[i]));

	PglPp pp(argv[1]);
	PglParser parser(&pp);

	if (const SynSym *s = parser.parse()) {
		PglStaticSemx semx;
		semx.interpret(*s);
		configureStream(cout, 2);
		s->print(cout, "");
		return 0;
	} else {
		cerr << here << "internal error: failed to interpret parsed " << 
			argv[1] << endl << xexit;
		return 2;
	}
}


syntax highlighted by Code2HTML, v. 0.9.1