I am trying to parse an string in GWT to an Object structure. Unfortunately I am not able to do it.
Example string:
"(node1(node2(node3) (node4)) (node5))"
"node1"has 2 children:"node2"and"node5""node2"has 2 children:"node3"and"node4"
Object can be “node”, with children.
Any help on this will be greatly appreciated.
I can provide you with a pseudo-code. I believe the following algorithm will work but please let me know if you spot anything wrong with it.
To keep track of parents, you can use a stack.