Changes in translator/main.cc [b1a6d6b:42e2ad7]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/main.cc
rb1a6d6b r42e2ad7 49 49 bool debugp = false, treep = false, astp = false, manglep = false, symtabp = false, validp = false; 50 50 bool preludep = true, protop = false, libp = false; 51 bool exprp = false, codegenp = false , errorp = false;51 bool exprp = false, codegenp = false; 52 52 int c; 53 53 FILE *input, *prelude, *builtins; … … 56 56 opterr = 0; 57 57 58 std::list< Declaration* > translationUnit; 59 60 while ( (c = getopt( argc, argv, "dtsgmvxcenprlDyz:" )) != -1 ) { 58 while ( (c = getopt( argc, argv, "dtsgmvxcenprlDz:" )) != -1 ) { 61 59 switch (c) { 62 60 case 'd': 63 / / bison debugging info61 /* bison debugging info */ 64 62 debugp = true; 65 63 break; 66 64 case 't': 67 / / dump parse tree65 /* dump parse tree */ 68 66 treep = true; 69 67 break; 70 68 case 's': 71 / / dump AST69 /* dump AST */ 72 70 astp = true; 73 71 break; 74 72 case 'g': 75 / / print alternatives for expressions73 /* print alternatives for expressions */ 76 74 manglep = true; 77 75 break; 78 76 case 'm': 79 / / print symbol table events77 /* print symbol table events */ 80 78 symtabp = true; 81 79 break; 82 80 case 'r': 83 / / print resolver steps81 /* print resolver steps */ 84 82 resolveVerbose = true; 85 83 break; 86 84 case 'x': 87 / / dump AST after decl validation pass85 /* dump AST after decl validation pass */ 88 86 validp = true; 89 87 break; 90 88 case 'e': 91 / / dump AST after expression analysis89 /* dump AST after expression analysis */ 92 90 exprp = true; 93 91 break; … … 95 93 codegenp = true; 96 94 break; 97 case 'y':98 errorp = true;99 break;100 95 case 'n': 101 / / don't read preamble96 /* don't read preamble */ 102 97 preludep = false; 103 98 break; 104 99 case 'p': 105 / / generate prototypes for preamble functions100 /* generate prototypes for preamble functions */ 106 101 protop = true; 107 102 break; 108 103 case 'l': 109 / / generate libcfa.c104 /* generate libcfa.c */ 110 105 libp = true; 111 106 break; 112 107 case 'v': 113 / / verbose108 /* verbose */ 114 109 beVerbose = true; 115 110 break; 116 111 case 'D': 117 / / ignore -Dxxx112 /* ignore -Dxxx */ 118 113 break; 119 114 case '?': … … 210 205 } // if 211 206 207 std::list< Declaration* > translationUnit; 212 208 buildList( Parser::get_parser().get_parseTree(), translationUnit ); 213 209 … … 237 233 238 234 if ( exprp ) { 239 InitTweak::tweak( translationUnit );240 235 SymTab::validate( translationUnit, false ); 236 ResolvExpr::resolve( translationUnit ); 237 printAll( translationUnit, std::cout ); 238 return 0; 239 } // if 240 241 if ( codegenp ) { 242 // print the tree right before code generation... 243 // InitTweak::mutate( translationUnit ); 244 // InitTweak::tweak( translationUnit ); 245 //printAll( translationUnit, std::cout ); 246 247 // std::cerr << "finished tweaking" << std::endl; 248 SymTab::validate( translationUnit, false ); 241 249 ControlStruct::mutate( translationUnit ); 242 250 CodeGen::fixNames( translationUnit ); 243 ResolvExpr::resolve( translationUnit );244 printAll( translationUnit, std::cout );245 return 0;246 } // if247 248 if ( codegenp ) {249 // print the tree right before code generation250 cerr << "tweak" << endl;251 InitTweak::tweak( translationUnit );252 cerr << "validate" << endl;253 SymTab::validate( translationUnit, false );254 cerr << "mutate" << endl;255 ControlStruct::mutate( translationUnit );256 cerr << "fixNames" << endl;257 CodeGen::fixNames( translationUnit );258 cerr << "resolve" << endl;259 251 ResolvExpr::resolve( translationUnit ); 260 cerr << "copyParams" << endl;261 252 GenPoly::copyParams( translationUnit ); 262 cerr << "convertSpecializations" << endl;263 253 GenPoly::convertSpecializations( translationUnit ); 264 cerr << "convertLvalue" << endl;265 254 GenPoly::convertLvalue( translationUnit ); 266 cerr << "box" << endl;267 255 GenPoly::box( translationUnit ); 268 if ( errorp ) { 269 printAll( translationUnit, std::cout ); 270 } 256 printAll( translationUnit, std::cout ); 271 257 return 0; 272 258 } // if … … 307 293 308 294 } catch ( SemanticError &e ) { 309 if ( errorp ) {310 printAll( translationUnit, std::cout );311 }312 295 e.print( cout ); 313 296 if ( output != &std::cout ) {
Note: See TracChangeset
for help on using the changeset viewer.