I'd like to pass a token class from Flex to Bison (ideally, a tr1::shared_ptr - a reference counted smart pointer class). However, in Bison itself I need to deal with a number of symbol types - tokens, AST nodes, and so on.

This means that I need to use a %union, but this is difficult because the classes are too complex to put in a union. Using class pointers in the union is difficult, because this messes up the reference counting, and I have to do manual resource management.

Is there anything new in Bison that could help with this (I'm on 1.875c)? Or can anyone suggest a work-around?

One fix might be to split up the Flex and Bison symbol types - is this possible? In other words, Flex and Bison communicate using only one type, and Bison has its own multiple types for terminals, non-terminals, and so on (it seems strange that F/B share a single YYSTYPE - why is this?)

Thanks -

Evan



_______________________________________________
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to