XAstReader *reader = new XAstReader; list < TreeNode * >*TreeNodeList; TreeNodeList = reader->readlist (GxlInputFile); // Counters for AST statistics long StmtCounter, DeclCounter, TypeCounter; long ConstCounter, ExprCounter; // Visit one node for time for (TNLIter = TreeNodeList->begin (); TNLIter != TreeNodeList->end (); TNLIter++) { NodeCode nc = (*TNLIter)->getCode (); if (TreeUtils::isStmt (nc)) StmtCounter++; else if (TreeUtils::isDecl (nc)) DeclCounter++; else if (TreeUtils::isType (nc)) TypeCounter++; else if (TreeUtils::isConst (nc)) ConstCounter++; else if (TreeUtils::isExpr (nc)) ExprCounter++; } long NodesNumber = TreeNodeList->size (); cout << "Total nodes: " << NodesNumber << "\n\n"; cout << "\tStmt nodes: " << StmtCounter << "\t\t" << (((double) (StmtCounter * 100)) / NodesNumber) "%\n"; cout << "\tDecl nodes: " << DeclCounter << "\t\t" << (((double) (DeclCounter * 100)) / NodesNumber) "%\n"; cout << "\tType nodes: " << TypeCounter << "\t\t" << (((double) (TypeCounter * 100)) / NodesNumber) "%\n"; cout << "\tConst nodes: " << ConstCounter << "\t\t" << (((double) (ConstCounter * 100)) / NodesNumber) "%\n"; cout << "\tExpr nodes: " << ExprCounter << "\t\t" << (((double) (ExprCounter * 100)) / NodesNumber) "%\n";