// Execute "reent test.dat" after compilation for a test! #include #include "reent.h" int main(int argc, char **argv) { // Let's get a compiler-object... some_compiler MyReentrantCompiler; ifstream file; // Skips over program name ++argv, --argc; // If there are any arguments (just the first file will be scanned!) if (argc > 0) { file.open(argv[0]); if (! file) { cerr << "error: could not open file '" << argv[0] << "'!" << endl; return 1; } // Compiles from file MyReentrantCompiler.compile(file); } // No arguments specified -> use default source (=STDIN) else MyReentrantCompiler.compile(); }