木、子→親

…なるほど

tree = [[
(Root (Spine (Neck (Head))
             (RClavicle (RUpperArm (RLowerArm (RHand))))
             (LClavicle (LUpperArm (LLowerArm (LHand)))))
      (RHip (RUpperLeg (RLowerLeg (RFoot))))
      (LHip (LUpperLeg (LLowerLeg (LFoot)))))
]]

while true do
  s, e, n = tree:find(' %((%a+)', e)
  if not n then break end
  print(n..' . '..tree:sub(1, s):gsub('%b()', ''):match'(%a+)%s*$')
end

Lua正規表現は括弧の対応が取れるのでそこそこ簡潔に書ける。