Symbol tables are implemented as a hierarchical tree of scopes,with the global scope serving as the root. All names declared atglobal scope are listed in the root. Global function names areimplemented as child nodes. Each function node serves as the rootof its own local names (its formal arguments and local variables)with child nodes catering for each nested scope of the function.Data structures are also implemented as nodes, each of which liststhe member names (with additional children to cater for memberswhich are themselves data structures).When searching for a name, we look within the node representingthe nearest enclosing scope of that name. If the name doesn't existthere, we look to the parent scope, working our way up the treeuntil the name is found. If we reach the global scope and the namestill isn't found, the name was not declared so the compilation hasto fail at that point.