[antlr-interest] C: get underlying graph and struct

Yves Weißig weissig at rbg.informatik.tu-darmstadt.de
Mon Dec 12 02:59:55 PST 2011


Hi!

Again a question regarding to the C backend:
What would be the steps to manually create a pANTLR3_BASE_TREE from scratch?
Maybe I don't see the wood for the trees, but I don't know how construct
a node and link it to some children.
Or this generally not a good idea because the tree points to the input
stream?
I was just curious because I want to reuse my unparser. Manually
constructing a tree would be convenient.

Best regards
Yves

Am 06.12.2011 15:05, schrieb Yves Weißig:
> Ah... thanks so much, I knew I was missing something really obvious.
> 
> Yves
> 
> Am 06.12.2011 13:07, schrieb Jim Idle:
>> The tree will stay until you free it, so if you need it outside that function, store the references higher up in the hierarchy. 
>>
>> Jim
>>
>> On Dec 6, 2011, at 18:33, Yves Weißig <weissig at rbg.informatik.tu-darmstadt.de> wrote:
>>
>>> Hi,
>>> I'm using the C backend for my generated grammar within my C++
>>> application. It works great so far, but I'm planning on restructuring my
>>> C++ code. I want to have distinct parse and unparse components. In
>>> between I want to plug in different transformation on the tree. Now my
>>> question: Once I generated my tree and I exit the C++ subroutine my tree
>>> is gone. My naive approach would be to recursively deep copy the
>>> ANTLR3_BASE_TREE_struct to a global variable, but I thought there might
>>> be a better solution? Have you done something similar? Any ideas how to
>>> solve this problem?
>>> Best regards
>>> Yves
>>>
>>> List: http://www.antlr.org/mailman/listinfo/antlr-interest
>>> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list