IsTransient flag and AST ctreation

Jun 1, 2015 at 10:19 AM
Hello

I try to understand AST creation algorithm in Irony.

How I understood If I mark no terminal symbol as "Transient", ASTbuilder should skip this node, but process child nodes.

But if I call Grammar.MakeTransient() - I mark term with IsTransient and NoAstNode flags. It break AST creation, because in AstBuilder.BuildAst(ParseTreeNode parseNode) I see line
if (term.Flags.IsSet(TermFlags.NoAstNode) || parseNode.AstNode != null) return;

How I can create AST from Syntax Tree with skip some internal syntax nodes?
Coordinator
Jun 4, 2015 at 10:25 PM
If you mark NonTerminal as transient, the Parse node itself would disappear from parse tree (concrete syntax tree), so AST node builder would never see it. And transient non-terminal never appears in the tree. It is used for definition of the grammar, but is considered useless extra in actual tree, so it is automatically eliminated by parser.
Does this answer your question? I don't quite understand your question, especially what's the problem with this 'if' statement for you
Roman