I am trying the python pyparsing for parsing. I got stuck up while making the recursive parser.
Let me explain the problem
I want to make the Cartesian product of the elements. The syntax is
cross({elements },{element})
I put in more specific way
cross({a},{c1}) or cross({a,b},{c1}) or cross({a,b,c,d},{c1}) or
So the general form is first group will have n elements (a,b,c,d). The second group will have one element that so the final output will be Cartesian Product.
The syntax is to be made recursive because it can go to n level like
cross(cross({a,b},{c1}),{c2})
This means cross a,b with c1. Lets say outcome us y. We again cross y it with c2
This can be till n level cross(cross(cross(cross......
What i want is to have object to be initialized using setparseAction
So i will have 2 class
class object1(object):
This will be used by a,b,c,d
class object2(object):
This will hold cross elements
I need help on this i am not able to make the recursive parser.