Exemple #1
0
//========================================================================================
// R201 program
//----------------------------------------------------------------------------------------
void UntypedASTBuilder::build_Program(Program * program)
{
   Sg_File_Info * start = NULL;
   SgUntypedGlobalScope * scope = NULL;
   SgUntypedFunctionDeclaration * decl = NULL;
   SgUntypedDeclarationList * declList = NULL;

   // set up the global program scope
   //
   scope = new SgUntypedGlobalScope(start);
   scope->set_declaration_list(new SgUntypedDeclarationList(start));  
   scope->set_statement_list(new SgUntypedStatementList(start));  
   scope->set_function_list(new SgUntypedFunctionDeclarationList(start));  

   SgUntypedFile * file = new SgUntypedFile(start);
   file->set_scope(scope);
   declList = file->get_scope()->get_declaration_list();

   // StartCommentBlock (ignore for now)
   //

   // ProgramUnit
   //
   std::vector<ProgramUnit*>* unitList = program->getProgramUnitList();
   for (int i = 0; i < unitList->size(); i++) {
      decl = dynamic_cast<SgUntypedFunctionDeclaration*>(unitList->at(i)->getPayload());  assert(decl);
      declList->get_decl_list().push_back(decl);
   }

   program->setPayload(file);
   
   printf("build_Program: ..................... %lu\n", declList->get_decl_list().size());

}
Exemple #2
0
//========================================================================================
// R1233 subroutine-subprogram
//----------------------------------------------------------------------------------------
void UntypedASTBuilder::build_SubroutineSubprogram(SubroutineSubprogram * subroutineSubprogram)
{
   Sg_File_Info * start = NULL;
   SgUntypedNamedStatement * stmt = NULL;
   SgUntypedDeclarationList* sgDeclList = NULL;
   SgUntypedStatementList* sgStmtList = NULL;
   SgUntypedSubroutineDeclaration * subroutine = NULL;

   // SubroutineStmt
   //
   if (subroutineSubprogram->getSubroutineStmt()) {
      subroutine = dynamic_cast<SgUntypedSubroutineDeclaration*>(subroutineSubprogram->getSubroutineStmt()->getPayload());
      assert(subroutine);
   }

   printf("build_MainSubroutine label: ........ %s\n", subroutine->get_label_string().c_str());
   printf("             begin name: ........... %s\n", subroutine->get_name().c_str());

   // SpecificationPart
   //
   SpecificationPart * specPart = subroutineSubprogram->getSpecificationPart();
   sgDeclList = dynamic_cast<SgUntypedDeclarationList*>(specPart->givePayload());  assert(sgDeclList);
   subroutine->get_scope()->set_declaration_list(sgDeclList);

   printf("         spec_list_size: ........... %lu\n", sgDeclList->get_decl_list().size());

   // ExecutionPart
   //
   ExecutionPart * execPart = subroutineSubprogram->getExecutionPart();
   sgStmtList = dynamic_cast<SgUntypedStatementList*>(execPart->givePayload());  assert(sgStmtList);
   subroutine->get_scope()->set_statement_list(sgStmtList);

   printf("         exec_list_size: ........... %lu\n", sgStmtList->get_stmt_list().size());

   // InternalSubprogramPart
   //
   InternalSubprogramPart * isubPart = subroutineSubprogram->getInternalSubprogramPart();
   if (isubPart) {
      SgUntypedFunctionDeclarationList* sgFuncList;
      sgFuncList = dynamic_cast<SgUntypedFunctionDeclarationList*>(isubPart->givePayload());  assert(sgFuncList);
      subroutine->get_scope()->set_function_list(sgFuncList);
   }

   // EndSubroutineStmt
   //
   stmt = dynamic_cast<SgUntypedNamedStatement*>(subroutineSubprogram->getEndSubroutineStmt()->getPayload());  assert(stmt);
   subroutine->set_end_statement(stmt);

   printf("              end label: ........... %s\n", stmt->get_label_string().c_str());
   printf("              end  name: ........... %s\n", stmt->get_statement_name().c_str());

   subroutineSubprogram->setPayload(subroutine);
}
//========================================================================================
// R201 program
//----------------------------------------------------------------------------------------
void UntypedASTBuilder::build_Program(Program * program)
{
#ifdef TODO_ROSE
   Sg_File_Info * start = NULL;
   SgUntypedGlobalScope * scope = NULL;
   SgUntypedDeclarationStatement * decl = NULL;
   SgUntypedDeclarationList * declList = NULL;

   // set up the global program scope
   //
   scope = new SgUntypedGlobalScope(start);
   scope->set_declaration_list(new SgUntypedDeclarationList(start));  
   scope->set_statement_list(new SgUntypedStatementList(start));  
   scope->set_function_list(new SgUntypedFunctionDeclarationList(start));  

   SgUntypedFile * file = new SgUntypedFile(start);
   file->set_scope(scope);
   declList = file->get_scope()->get_declaration_list();

   // StartCommentBlock (ignore for now)
   //

   // ProgramUnit
   //
   std::vector<ProgramUnit*>* unitList = program->getProgramUnitList();
   for (int i = 0; i < unitList->size(); i++) {
      decl = dynamic_cast<SgUntypedDeclarationStatement*>(unitList->at(i)->getPayload());  assert(decl);
      declList->get_decl_list().push_back(decl);
   }

   program->setPayload(file);
   
#ifdef OFP_BUILD_DEBUG
   printf("build_Program: ..................... %lu\n", declList->get_decl_list().size());
#endif
#else
   printf ("UntypedASTBuilder::build_Program(): calling ROSE build functions \n");

   SgUntypedDeclarationList* declaration_list      = NULL;
   SgUntypedStatementList* statement_list          = NULL;
   SgUntypedFunctionDeclarationList* function_list = NULL;

   SgUntypedGlobalScope* globalScope = SageBuilder::buildUntypedGlobalScope(declaration_list,statement_list,function_list);

   SgUntypedFile* file = SageBuilder::buildUntypedFile(globalScope);

   program->setPayload(file);
#endif
}
Exemple #4
0
//========================================================================================
// R205 implicit-part
//----------------------------------------------------------------------------------------
void UntypedASTBuilder::build_ImplicitPart(ImplicitPart* implicitPart)
{
   SgUntypedDeclarationStatement * decl = NULL;

   SgUntypedDeclarationList * sgDeclList = new SgUntypedDeclarationList(NULL);
   std::vector<ImplicitPartStmt*>* ipartList = implicitPart->getImplicitPartStmtList();

   for (int i = 0; i < ipartList->size(); i++) {
      decl = dynamic_cast<SgUntypedDeclarationStatement*>(ipartList->at(i)->getPayload());  assert(decl);
      sgDeclList->get_decl_list().push_back(decl);
   }
   decl = dynamic_cast<SgUntypedDeclarationStatement*>(implicitPart->getImplicitStmt()->getPayload());  assert(decl);
   sgDeclList->get_decl_list().push_back(decl);

   implicitPart->setPayload(sgDeclList);

   printf("build_ImplicitPart: .............. %lu\n", sgDeclList->get_decl_list().size());
}
//========================================================================================
// R204 specification-part
//----------------------------------------------------------------------------------------
void UntypedASTBuilder::build_InitialSpecPart(InitialSpecPart * initialSpecPart)
{
#ifdef TODO_ROSE
   SgUntypedDeclarationStatement * decl = NULL;
   SgUntypedDeclarationList * sgDeclList = new SgUntypedDeclarationList(NULL);

   std::vector<Statement*>* stmtList = initialSpecPart->getStatementList();
   for (int i = 0; i < stmtList->size(); i++) {
      decl = dynamic_cast<SgUntypedDeclarationStatement*>(stmtList->at(i)->getPayload());  assert(decl);
      sgDeclList->get_decl_list().push_back(decl);
   }

   initialSpecPart->setPayload(sgDeclList);

#ifdef OFP_BUILD_DEBUG
   printf("build_InitialSpecPart: ........... %lu\n", sgDeclList->get_decl_list().size());
#endif
#endif
}
void UntypedASTBuilder::build_SpecificationPart(SpecificationPart * specificationPart)
{
   SgUntypedDeclarationStatement * decl = NULL;
   SgUntypedDeclarationList * sgDeclList = new SgUntypedDeclarationList(NULL);

   std::vector<UseStmt*>* useList = specificationPart->getUseStmtList();
   for (unsigned int i = 0; i < useList->size(); i++) {
      decl = dynamic_cast<SgUntypedDeclarationStatement*>(useList->at(i)->getPayload());  assert(decl);
      sgDeclList->get_decl_list().push_back(decl);
   }

   std::vector<ImportStmt*>* importList = specificationPart->getImportStmtList();
   for (unsigned int i = 0; i < importList->size(); i++) {
      decl = dynamic_cast<SgUntypedDeclarationStatement*>(importList->at(i)->getPayload());  assert(decl);
      sgDeclList->get_decl_list().push_back(decl);
   }

   ImplicitPart* implicitPart = specificationPart->getImplicitPart();
   if (implicitPart) {
      SgUntypedDeclarationList * implList;
      implList = dynamic_cast<SgUntypedDeclarationList*>(implicitPart->getPayload());  assert(implList);
      for (unsigned int i = 0; i < implList->get_decl_list().size(); i++) {
         decl = dynamic_cast<SgUntypedDeclarationStatement*>(implList->get_decl_list().at(i));  assert(decl);
         sgDeclList->get_decl_list().push_back(decl);
      }
   }

   std::vector<DeclarationConstruct*>* declList = specificationPart->getDeclarationConstructList();
   for (unsigned int i = 0; i < declList->size(); i++) {
      decl = dynamic_cast<SgUntypedDeclarationStatement*>(declList->at(i)->getPayload());  assert(decl);
      sgDeclList->get_decl_list().push_back(decl);
   }

   specificationPart->setPayload(sgDeclList);
   
#ifdef OFP_BUILD_DEBUG
   printf("build_SpecificationPart: ........... %lu\n", sgDeclList->get_decl_list().size());
#endif
}
Exemple #7
0
//========================================================================================
// R1101 main-program
//----------------------------------------------------------------------------------------
void UntypedASTBuilder::build_MainProgram(MainProgram * mainProgram)
{
   Sg_File_Info * start = NULL;
   SgUntypedNamedStatement * stmt = NULL;
   SgUntypedDeclarationList* sgDeclList = NULL;
   SgUntypedStatementList* sgStmtList = NULL;
   SgUntypedProgramHeaderDeclaration * program = NULL;

   // ProgramStmt
   //
   if (mainProgram->getProgramStmt()) {
      program = dynamic_cast<SgUntypedProgramHeaderDeclaration*>(mainProgram->getProgramStmt()->getPayload());  assert(program);
   }
   else {
      // no optional ProgramStmt
      SgUntypedFunctionScope * scope = new SgUntypedFunctionScope(NULL);
      scope->set_declaration_list(new SgUntypedDeclarationList(NULL));  
      scope->set_statement_list(new SgUntypedStatementList(NULL));  
      scope->set_function_list(new SgUntypedFunctionDeclarationList(NULL));  

      program = new SgUntypedProgramHeaderDeclaration(NULL, "");
      program->set_statement_enum(SgToken::FORTRAN_PROGRAM);
      program->set_scope(scope);
   }

   printf("build_MainProgram label: ........... %s\n", program->get_label_string().c_str());
   printf("             begin name: ........... %s\n", program->get_name().c_str());

   // SpecificationPart
   //
   SpecificationPart * specPart = mainProgram->getSpecificationPart();
   sgDeclList = dynamic_cast<SgUntypedDeclarationList*>(specPart->givePayload());  assert(sgDeclList);
   program->get_scope()->set_declaration_list(sgDeclList);

   printf("         spec_list_size: ........... %lu\n", sgDeclList->get_decl_list().size());

   // ExecutionPart
   //
   ExecutionPart * execPart = mainProgram->getExecutionPart();
   sgStmtList = dynamic_cast<SgUntypedStatementList*>(execPart->givePayload());  assert(sgStmtList);
   program->get_scope()->set_statement_list(sgStmtList);

   printf("         exec_list_size: ........... %lu\n", sgStmtList->get_stmt_list().size());

   // InternalSubprogramPart
   //
   InternalSubprogramPart * isubPart = mainProgram->getInternalSubprogramPart();
   if (isubPart) {
      SgUntypedFunctionDeclarationList* sgFuncList;
      sgFuncList = dynamic_cast<SgUntypedFunctionDeclarationList*>(isubPart->givePayload());  assert(sgFuncList);
      program->get_scope()->set_function_list(sgFuncList);
   }

   // EndProgramStmt
   //
   stmt = dynamic_cast<SgUntypedNamedStatement*>(mainProgram->getEndProgramStmt()->getPayload());  assert(stmt);
   program->set_end_statement(stmt);

   printf("              end label: ........... %s\n", stmt->get_label_string().c_str());
   printf("              end  name: ........... %s\n", stmt->get_statement_name().c_str());

   mainProgram->setPayload(program);
}
//========================================================================================
// R1233 subroutine-subprogram
//----------------------------------------------------------------------------------------
void UntypedASTBuilder::build_SubroutineSubprogram(SubroutineSubprogram * subroutineSubprogram)
{
#if 0
   Sg_File_Info * start = NULL;
   SgUntypedNamedStatement * stmt = NULL;
   SgUntypedDeclarationList* sgDeclList = NULL;
   SgUntypedStatementList* sgStmtList = NULL;
   SgUntypedSubroutineDeclaration * subroutine = NULL;

   // SubroutineStmt
   //
   subroutine = dynamic_cast<SgUntypedSubroutineDeclaration*>(subroutineSubprogram->getSubroutineStmt()->getPayload());
   assert(subroutine);
   start = subroutine->get_startOfConstruct();
   subroutine->set_scope(new SgUntypedFunctionScope(start));

#ifdef OFP_BUILD_DEBUG
   printf("build_Subroutine  label: ........... %s\n", subroutine->get_label_string().c_str());
   printf("             begin name: ........... %s\n", subroutine->get_name().c_str());
#endif

   // InitialSpecPart
   //
   InitialSpecPart * specPart = subroutineSubprogram->getInitialSpecPart();
   sgDeclList = dynamic_cast<SgUntypedDeclarationList*>(specPart->givePayload());  assert(sgDeclList);
   subroutine->get_scope()->set_declaration_list(sgDeclList);

#ifdef OFP_BUILD_DEBUG
   printf("         spec_list_size: ........... %lu\n", sgDeclList->get_decl_list().size());
#endif

   // SpecAndExecPart
   //
   SpecAndExecPart * execPart = subroutineSubprogram->getSpecAndExecPart();
   sgStmtList = dynamic_cast<SgUntypedStatementList*>(execPart->givePayload());  assert(sgStmtList);
   subroutine->get_scope()->set_statement_list(sgStmtList);

#ifdef OFP_BUILD_DEBUG
   printf("         exec_list_size: ........... %lu\n", sgStmtList->get_stmt_list().size());
#endif

   // InternalSubprogramPart
   //
   InternalSubprogramPart * isubPart = subroutineSubprogram->getInternalSubprogramPart();
   if (isubPart) {
      SgUntypedFunctionDeclarationList* sgFuncList;
      sgFuncList = dynamic_cast<SgUntypedFunctionDeclarationList*>(isubPart->givePayload());  assert(sgFuncList);
      subroutine->get_scope()->set_function_list(sgFuncList);
   }
   else {
      subroutine->get_scope()->set_function_list(new SgUntypedFunctionDeclarationList(NULL));  
   }

   // EndSubroutineStmt
   //
   stmt = dynamic_cast<SgUntypedNamedStatement*>(subroutineSubprogram->getEndSubroutineStmt()->getPayload());  assert(stmt);
   subroutine->set_end_statement(stmt);

#ifdef OFP_BUILD_DEBUG
   printf("              end label: ........... %s\n", stmt->get_label_string().c_str());
   printf("              end  name: ........... %s\n", stmt->get_statement_name().c_str());
#endif

   subroutineSubprogram->setPayload(subroutine);
#endif
}
//========================================================================================
// R1227 function-subprogram
//----------------------------------------------------------------------------------------
void UntypedASTBuilder::build_FunctionSubprogram(FunctionSubprogram* functionSubprogram)
{
#if 0
   Sg_File_Info * start = NULL;
   SgUntypedNamedStatement * stmt = NULL;
   SgUntypedDeclarationList* sgDeclList = NULL;
   SgUntypedStatementList* sgStmtList = NULL;
   SgUntypedFunctionDeclaration * function = NULL;

   // FunctionStmt
   //
   function = dynamic_cast<SgUntypedFunctionDeclaration*>(functionSubprogram->getFunctionStmt()->getPayload());
   assert(function);
   start = function->get_startOfConstruct();
   function->set_scope(new SgUntypedFunctionScope(start));
#if UNPARSER_AVAILABLE
   function->set_has_unparse(true);
#endif

#ifdef OFP_BUILD_DEBUG
   printf("build_Function    label: ........... %s\n", function->get_label_string().c_str());
   printf("             begin name: ........... %s\n", function->get_name().c_str());
#endif

   // InitialSpecPart
   //
   InitialSpecPart * specPart = functionSubprogram->getInitialSpecPart();
   sgDeclList = dynamic_cast<SgUntypedDeclarationList*>(specPart->givePayload());  assert(sgDeclList);
   function->get_scope()->set_declaration_list(sgDeclList);

#ifdef OFP_BUILD_DEBUG
   printf("         spec_list_size: ........... %lu\n", sgDeclList->get_decl_list().size());
#endif

   // SpecAndExecPart
   //
   SpecAndExecPart * execPart = functionSubprogram->getSpecAndExecPart();
   sgStmtList = dynamic_cast<SgUntypedStatementList*>(execPart->givePayload());  assert(sgStmtList);
   function->get_scope()->set_statement_list(sgStmtList);

#ifdef OFP_BUILD_DEBUG
   printf("         exec_list_size: ........... %lu\n", sgStmtList->get_stmt_list().size());
#endif

   // InternalSubprogramPart
   //
   InternalSubprogramPart * isubPart = functionSubprogram->getInternalSubprogramPart();
   if (isubPart) {
      SgUntypedFunctionDeclarationList* sgFuncList;
      sgFuncList = dynamic_cast<SgUntypedFunctionDeclarationList*>(isubPart->givePayload());  assert(sgFuncList);
      function->get_scope()->set_function_list(sgFuncList);
   }
   else {
      function->get_scope()->set_function_list(new SgUntypedFunctionDeclarationList(NULL));
   }

   // EndFunctionStmt
   //
   stmt = dynamic_cast<SgUntypedNamedStatement*>(functionSubprogram->getEndFunctionStmt()->getPayload());  assert(stmt);
   function->set_end_statement(stmt);

#ifdef OFP_BUILD_DEBUG
   printf("              end label: ........... %s\n", stmt->get_label_string().c_str());
   printf("              end  name: ........... %s\n", stmt->get_statement_name().c_str());
#endif

   functionSubprogram->setPayload(function);
#endif
}
//========================================================================================
// R1104 module
//----------------------------------------------------------------------------------------
void UntypedASTBuilder::build_Module(Module* module)
{
#if 0
   Sg_File_Info * start = NULL;
   SgUntypedNamedStatement * endStmt = NULL;
   SgUntypedDeclarationList * sgDeclList = NULL;
   SgUntypedModuleDeclaration * sgModule = NULL;

   // ModuleStmt
   //
   sgModule = dynamic_cast<SgUntypedModuleDeclaration*>(module->getModuleStmt()->getPayload());  assert(sgModule);
   start = sgModule->get_startOfConstruct();
   sgModule->set_scope(new SgUntypedModuleScope(start));
#if UNPARSER_AVAILABLE
   sgModule->set_has_unparse(true);
#endif

#ifdef OFP_BUILD_DEBUG
   printf("build_Module label: ................ %s\n", sgModule->get_label_string().c_str());
#if 0
// DQ (9/10/2014): Need to add name data member for SgUntypedModuleDeclaration.
   printf("             begin name: ........... %s\n", sgModule->get_name().c_str());
#endif
#endif

   // SpecificationPart
   //
   SpecificationPart * specPart = module->getSpecificationPart();
   sgDeclList = dynamic_cast<SgUntypedDeclarationList*>(specPart->givePayload());  assert(sgDeclList);
   sgModule->get_scope()->set_declaration_list(sgDeclList);

#ifdef OFP_BUILD_DEBUG
   printf("         spec_list_size: ........... %lu\n", sgDeclList->get_decl_list().size());
#endif

   // ModuleSubprogramPart
   //
   ModuleSubprogramPart * msubPart = module->getModuleSubprogramPart();
   if (msubPart) {
      SgUntypedScope * msubScope = dynamic_cast<SgUntypedScope*>(msubPart->givePayload());  assert(msubScope);
      sgModule->get_scope()->set_statement_list(msubScope->get_statement_list());
      sgModule->get_scope()->set_function_list (msubScope->get_function_list());
   }
   else {
      sgModule->get_scope()->set_statement_list(new SgUntypedStatementList(NULL));
      sgModule->get_scope()->set_function_list (new SgUntypedFunctionDeclarationList(NULL));
   }

   // EndModuleStmt
   //
   endStmt = dynamic_cast<SgUntypedNamedStatement*>(module->getEndModuleStmt()->getPayload());  assert(endStmt);
   sgModule->set_end_statement(endStmt);

#ifdef OFP_BUILD_DEBUG
   printf("              end label: ........... %s\n", endStmt->get_label_string().c_str());
   printf("              end  name: ........... %s\n", endStmt->get_statement_name().c_str());
#endif

   module->setPayload(sgModule);
#endif
}
//========================================================================================
// R1101 main-program
//----------------------------------------------------------------------------------------
void UntypedASTBuilder::build_MainProgram(MainProgram * mainProgram)
{
#ifdef TODO_ROSE
   Sg_File_Info * start = NULL;
   SgUntypedNamedStatement * stmt = NULL;
   SgUntypedDeclarationList* sgDeclList = NULL;
   SgUntypedStatementList* sgStmtList = NULL;
   SgUntypedProgramHeaderDeclaration * program = NULL;

   // ProgramStmt
   //
   if (mainProgram->getProgramStmt()) {
      program = dynamic_cast<SgUntypedProgramHeaderDeclaration*>(mainProgram->getProgramStmt()->getPayload());  assert(program);
   }
   else {
      // no optional ProgramStmt
      program = new SgUntypedProgramHeaderDeclaration(NULL, "");
      program->set_statement_enum(SgToken::FORTRAN_PROGRAM);
   }
   program->set_scope(new SgUntypedFunctionScope(start));
#if UNPARSER_AVAILABLE
   program->set_has_unparse(true);
#endif

#ifdef OFP_BUILD_DEBUG
   printf("build_MainProgram label: ........... %s\n", program->get_label_string().c_str());
   printf("             begin name: ........... %s\n", program->get_name().c_str());
#endif

   // InitialSpecPart
   //
   InitialSpecPart * specPart = mainProgram->getInitialSpecPart();
   sgDeclList = dynamic_cast<SgUntypedDeclarationList*>(specPart->givePayload());  assert(sgDeclList);
   program->get_scope()->set_declaration_list(sgDeclList);

#ifdef OFP_BUILD_DEBUG
   printf("         spec_list_size: ........... %lu\n", sgDeclList->get_decl_list().size());
#endif

   // SpecAndExecPart
   //
   SpecAndExecPart * execPart = mainProgram->getSpecAndExecPart();
   sgStmtList = dynamic_cast<SgUntypedStatementList*>(execPart->givePayload());  assert(sgStmtList);
   program->get_scope()->set_statement_list(sgStmtList);

#ifdef OFP_BUILD_DEBUG
   printf("         exec_list_size: ........... %lu\n", sgStmtList->get_stmt_list().size());
#endif

   // InternalSubprogramPart
   //
   InternalSubprogramPart * isubPart = mainProgram->getInternalSubprogramPart();
   if (isubPart) {
      SgUntypedScope * isubScope = dynamic_cast<SgUntypedScope*>(isubPart->givePayload());  assert(isubScope);
      SgUntypedStatementList * sgStmtList = isubScope->get_statement_list();
      SgUntypedFunctionDeclarationList * sgFuncList = isubScope->get_function_list();

      // has one contains stmt
      SgUntypedStatement * contains = sgStmtList->get_stmt_list().front();
      program->get_scope()->get_statement_list()->get_stmt_list().push_back(contains);
      program->get_scope()->set_function_list(sgFuncList);
      sgStmtList->get_stmt_list().clear();
   }
   else {
      program->get_scope()->set_function_list(new SgUntypedFunctionDeclarationList(NULL));
   }

   // EndProgramStmt
   //
   stmt = dynamic_cast<SgUntypedNamedStatement*>(mainProgram->getEndProgramStmt()->getPayload());  assert(stmt);
   program->set_end_statement(stmt);

#ifdef OFP_BUILD_DEBUG
   printf("              end label: ........... %s\n", stmt->get_label_string().c_str());
   printf("              end  name: ........... %s\n", stmt->get_statement_name().c_str());
#endif

   mainProgram->setPayload(program);
#else
   printf ("UntypedASTBuilder::build_MainProgram(): commented out! \n");
#endif
}