[prev in list] [next in list] [prev in thread] [next in thread]
List: antlr-interest
Subject: [antlr-interest] Identifying a TNode
From: nobrow () eircom ! net (Alan Larkin)
Date: 2007-02-24 15:58:40
Message-ID: 45E060B0.1020104 () eircom ! net
[Download RAW message or body]
b:binaryOperator
{
TNode e1, e2;
e1 = (TNode)b.getFirstChild();
e2 = (TNode)e1.getNextSibling();
expr(e1);
print(b);
expr(e2);
}
You see the above ... It comes from cgram (GnuCEmitter.g). I am taking this as a starting point to
implement some unusual language translation. I have a question.
Is it possible to look into each of the TNodes to see what they expand to?
In this case,
expr ::= binaryExpr | conditionalExpr | castExpr | unaryExpr | ...
I need to be able to identify the case where e1 and/or e2 turn into unaryExpr, and in such cases
avoid doing the processing I would otherwise do.
Any ideas?
Thanks.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic