get_globals_from_root function

Extract global variable names from a parsed tree root