   Help needed for parsing algorithm
  I'm trying to find a clever way to parse the following text file  (well, a part of it) so that it would be organized in nodes (i'd like to end up with a c# treeview).version // NODE   {   number 8.2}morphBinaryFile grizzly.pmd // NODEfigureResFile Grizzly.obj  // NODEactor BODY:3  // NODE{}actor BODY:3 // NODE   {name    BODYonbend 1dynamicsLock0hidden0addToMenu1castsShadow1includeInDepthCue1useZBuffer1parent UNIVERSEcreaseAngle 80channels // NODE{groups // NODE{groupNode Transform  // NODE{parmNode ScaleparmNode xScaleparmNode yScaleparmNode zScaleparmNode TwistparmNode BendparmNode Side-SideparmNode xTranparmNode yTranparmNode zTran}groupNode Other  // NODE{parmNode Roar}}  }   }As you can see each node section is included in a {} block. But since the file structure expands to several levels of recursion, I failed to find a way to build some code that would, for example, create an array where, for each text line, would store the parent node.I'm really stuck so any help is greatly appreciated.   
  Have a look at boost spirit which great for parsing files.   ;  Thanks but too complicate.   ;  Recursion is one easy way of solving your problem...void Node::read(){  string line = readline().trim();  if( line == "}" ) return;  if( line == "{" )  {    Node node = new Node(this); // set parent    node.read(); // recursive call    add(node);  }  else  {    add(new Attribute(line));  }} [Edited by - sirGustav on April 14, 2010 12:03:43 AM];  What language are you using? (And why?)   