#include "ast.hh"
using namespace ast;
#include "pretty_printer.hh"
#include <cstdio>
#include <iostream>
int yyparse();
ast::DProg *dprog = 0;
int
main (int argc, char *argv[])
{
FILE *f;
/* FIXME: I really want some "real" option parsing here... */
/* re-open 'stdin' and 'stdout' if these are given on the command
* line */
if (argv[1] != NULL) {
f = freopen(argv[1], "r", stdin);
if (f == NULL)
{
std::cerr << "Couldn't open input file `"
<< argv[1] << "'\n";
exit(1);
}
}
yyparse();
if (!dprog)
return 2; // parse error!
std::cout << (*dprog);
return 0;
}
syntax highlighted by Code2HTML, v. 0.9.1