constructing packages hierarchy from ast