Question: Can you please modify the delete _ from _ scope ( ) and print _ scope _ table ( ofstream& outlog ) functions in the

Can you please modify the delete_from_scope() and print_scope_table(ofstream& outlog) functions in the scope_table class so that the output structure is as shown below:
ScopeTable # 2
7-->
< a : ID >
Variable
Type: int
8-->
< b : ID >
Variable
Type: float
ScopeTable # 1
8-->
< func : ID >
Function Definition
Return Type: int
Number of Parameters: 2
Parameter Details: int a, float b
################################
Scopetable with ID 2 removed
Funtions to be modified:
bool delete_from_scope(symbol_info* symbol){
int index = hash_function(symbol->get_name());
if (table[index]!= nullptr && table[index]->get_name()== symbol->get_name()){
table[index]= nullptr;
return true; // if symbol is found in the scope
}
else {
return false; // if symbol is not found in the scope
}
}
void print_scope_table(ofstream& outlog){
outlog << "ScopeTable # "+ to_string(unique_id)<< endl;
//iterate through the current scope table and print the symbols and all relevant information
for (int i =0; i < bucket_count; ++i){
for (symbol_info* s : table[i]){
outlog << "Bucket no."<< i <<": "<< s->get_name()<<"->"<< s->get_type()<< endl;
}
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!