I have clauses like a(b,c(d,e(f,g),h(i))) and a string which has a number of clauses separated by a comma for example, a(b,c(d,e(f,g),h(i))),a(b,c(d,e(f,g),h(i)))
Is there a way to extract variable and function names in their hierarchical order? Suppose I want to print them as follows,
a
b
c
d
e
f
g
h
i
how can I do this by using Python's parser easily? what regex should I use?