This project has moved and is read-only. For the latest updates, please go here.

Problems with handling AST

Jun 10, 2009 at 1:58 PM

Hey, it's me again with another problem (not of the software, but with my understanding of using it)

I'm trying to generate a XML document out of the AST. When I was using the Irony version of December 2008, (almost) everything worked fine. I took the tutorial from and adapted the source code for my needs. What I actually did was to implement a own class for every non-terminal node which inherited from the AstNode class as well as from an interface. Then I went through the whole tree and handled the nodes/tokens.

Now, with the newest version of Irony, I just can't figure out how I can solve my problem. I kept all the custom AstNode classes and implemented the IAstNodeInit interface. The Init() methods are blank. I also use the SetLanguageFlags(LanguageFlags.CreateAst, true). So far so good. But how can I go through all AstNode's for generating my XML document? Do I have to use AST, or is the ParseTree sufficient for my purpose?

By the way, I want to use .NET's XmlSerialization. I'm happy about every single hint.

Jun 10, 2009 at 4:47 PM

In latest source from Source Code page, the AST nodes and all scripting functionality are not brought back to life after refactoring. If all you need is generate XML, then ParseTree is sufficient to do this, you don't need to create AST nodes. Just traverse the parse tree and generate XML