hi,
i'm currently developing a small expression interpreter using antlr, and came accross the following problem: consider an 'if' expression of the following form: if(condition-expression,then-expression,else-expression) where the if expression yields the result of "then" if the condition evaluates to true, and "else" otherwise. it can be the case that the evaluation (custom action) of either "then" or "else" fails (for example, has a division through zero), but is not needed. consider the following: if(true,1,1/0) would crash, even though the "else" expression is never needed. the matcher in the tree grammer identifies the parameters correctly as expressions, and evaluates them before calling my custom "if" action. is there a way to lazyly evaluate expressions? i managed to solve the problem by writing a custom tree walker instead of using a tree grammar to evaluate the parse tree. however, i would greatly prefer a way using antlr. any help would be greatly appreciated thanks lukas List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- 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.
