Robert Soule wrote:
Once you have created the parser, just install a pointer to your own
adaptor. You can also do this in @apifuncs I think. As in:

ADAPTOR = pointerToMyAdaptor;

    

OK, thank you. This worked for me, but I end up with code like:

    ADAPTOR     = ANTLR3_TREE_ADAPTORNew(...);
    ctx->vectors        = antlr3VectorFactoryNew(64);

    ADAPTOR = MY_CUSTOM_TREE_ADAPTORNew(...);

Which works, but calls the ANTLR3_TREE_ADAPTORNew unnecessarily.
Is there a way to avoid that?
  
No, but it is a single malloc of a small struct and no big deal really. I could probably make an #ifdef around it at some point.

To be honest with you, even in Java I have found it easier just to call
my own functions directly from actions and not try and create an
adaptor, thoguh this is essentially because of what type of tree is
needed in the case of errors and so on.

    

You mean to use the actions instead of the re-write rules? 
Yes.
I can see
that being true, but it does end up tying your grammar in to a specific
generated code. Ideally, I'd like my grammar to be as target-language
agnostic as possible.
  
Sure - the adaptor will work, but will possibly be more work. I am not sure if you might not have to be tricky with the rewrite stream functions. I shall have to review those as I may have made them have too much knowledge of CommonTree in the latest code - hmmm :-( Well, we will soon find out!

Jim
thanks for your help,
Robert
  


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

Reply via email to