[antlr-interest] [C-target] Child-parent relationship

Дмитрий Ильин dmitry.m.ilyin at gmail.com
Wed Apr 27 03:52:50 PDT 2011


---------- Пересланное сообщение ----------
От кого: Дмитрий Ильин <dmitry.m.ilyin at gmail.com>
Дата: 27 апреля 2011 г. 17:49
Тема: [C-target] Child-parent relationship
Кому: antlr-interest at antlr.org


Hi!
Please correct me if I'm wrong. When constructing AST, child-parent
relationships are created by calling "freshenPACindixesAll" in function
"addChild"?
If so why "freshenPACindixesAll" is called only in one branch of
if-statement?
(antlr3basetree.c)

Why do we do selected action in function "setParent"? As a parent of "tree"
we set parent of "parent".

static void
setParent (pANTLR3_BASE_TREE tree, pANTLR3_BASE_TREE parent)
{
((pANTLR3_COMMON_TREE)(tree->super))->parent = parent == NULL ? NULL :
((pANTLR3_COMMON_TREE)(parent->super))->parent;
}

Dmitry Ilyin


More information about the antlr-interest mailing list