[antlr-interest] Re: Tree transformation
Arnar Birgisson
arnarb at oddi.is
Tue Nov 18 09:41:58 PST 2003
Hullo..
> -----Original Message-----
> From: Ric Klaren [mailto:klaren at cs.utwente.nl]
>
> Nope ;) but there didn't seem to be a problem anymore.
Not on my behalf no.. sorry for stirring you all up :o)
> I'm unsure atm wether Arnar's problems were all related to the 'lying'
> prettyprinter or that there's still some strange stuff.
Inside actions, I used just "label" to refer to subtrees. In that case,
the resulting tree was quite strange, as reported by the "truthful"
pretty-printer as well. After changing it to "#label", as Loring
suggested, it worked fine.
I understand the difference between #label and #label_in, but what does
label by it self mean? I haven't looked a the generated output yet so
maybe my question is stupid.
To clarify "quite strange" above, this is a simpilifaction of what
happened:
I have rules that transform
LIST
|
expr1 - expr2 - ... - exprN
to
FUNC_CALL
|
"mkPair" - parameters
|
expr1 - FUNC_CALL
|
"mkPair" - parameters
|
expr2 - FUNC_CALL
|
etc...
But when the #(LIST (expr)*) subrule was labeled with some label, and
then referred to without any #-marks in front, the resulting tree was
like this
LIST
|
expr1 - FUNC_CALL
|
"mkPair" - parameters
|
expr2 - ...
So obviously "some" transformation took place, but not on the top-level.
Again, I have this solved, so don't lose any sleep over this.
Arnar
ps. I could provide you with a grammar that exhibits this problem, but
all variable- and rulenames are in icelandic so you'd probably have a
hard time following it.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list