Хотел бы превратить текст с вложенными скобками во вложенный массив. Вот пример вывода парсера НЛП:
(TOP (S (NP (PRP I)) (VP (VBP love) (NP (NP (DT a) (JJ big) (NN bed)) (PP (IN of) (NP (NNS roses))))) (. .)))
(ориг. Я люблю большую клумбу из роз.)
Хотел бы превратить это во вложенный массив, чтобы он выглядел примерно так
TOP
S
NP
PRP I
VP
VBP Love
и т.п.
Нашел этот фигурные скобки php в массив, но это не вложенный массив