[antlr-interest] Tree transformations

Jeff Dahl jddahl at micron.com
Thu Jul 14 08:55:03 PDT 2005


When transforming a tree, is it possible to move a subtree to some 
arbitrary node?  For example, given the tree:

    A
    |-- B
    |   |-- C
    |   |   |-- attribute1
    |   |   |   `-- value 1
    |   |   |-- attribute2
    |   |   |   `-- value 2
    |   |   `-- attribute3
    |   |       `-- value 3
    |   `-- D
    |       `-- attribute4
    |           `-- value 4
    |-- E
    |   `-- attribute5
    |       `-- value 5
    `-- F
        `-- attribute6
            `-- value 6

is it possible to move subtree "C" to subtree "E" as illustrated below?

    A
    |-- B
    |   `-- D
    |       `-- attribute4
    |           `-- value 4
    |-- E
    |   |-- C
    |   |   |-- attribute1
    |   |   |   `-- value 1
    |   |   |-- attribute2
    |   |   |   `-- value 2
    |   |   `-- attribute3
    |   |       `-- value 3 
    |   `-- attribute5
    |       `-- value 5
    `-- F
        `-- attribute6
            `-- value 6

Thanks,
Jeff



More information about the antlr-interest mailing list