Hi, I'm writing a parser at the moment. The first step I did using petit parser to get from the grammar to my own AST like structure. Now I like to create my working model from the AST. And I'm thinking what would be the best way to do. If I want to create a model from the structure it turns out to be more difficult than I thought it would be. I'm using a visitor for this. In a typical visitor every element is treated in isolation. I can treat subelement B in the visitor but I cannot assign it to its parent A because there is no link. And I'm not really convinced that introducing return values in the visitor is the right way to go. What I need to do is a visitor that transforms one thing into another thing with having the need that existing parent-child relationships need to be preserved through the transformation. Anyone has an idea. Any hints are appreciated, Norbert