Ok I've come a long way and have a functional parser using lemon and
flex. However, there are a few unresolved items that I need help with.
1. My non-terminal token destructors are not getting called. The
terminal destructors work fine, but none of my terminal tokens need
destruction. Two of my non-terminals definitely require destruction. I
have properly defined the %destructor and instrumented the destructor
code with std::cout << "in destructor" << std::endl;. They are simply
not being called. Ever. The only thing I can think of is that I'm not
actually calling malloc on the terminal itself - the terminal is a
struct that contains a pointer element which receives a malloc, e.g.:
struct myTerminal { int* array; int count; }
...
A.array = (int*) malloc(A.count * sizeof(int));
2. Whenever there is a syntax error, the %syntax_error handler is called
multiple times (once for each time it pops the stack). I know this is
by design, but I need to send a NAK on a malformed message and I need a
way to only send that NAK once. The lemon documentation vaguely
mentions a "error" non-terminal. What would be a good strategy for
managing syntax errors in a way that only notifies once for each
malformed message?
RW
Ron Wilson, Senior Engineer, MPR Associates, 518.831.7546
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------