[antlr-interest] suppressing evaluation in tree parsers

Michael @ myacc mjl at myacc.net
Thu Nov 1 04:50:18 PDT 2007


I'm writing a tree parser for evaluating expressions with numerous
variants (literal, variable reference, primitive application,
procedure, etc).  Sometimes I want to suppress evaluation of
a subtree and simply capture a reference to its root node,
to evaluate the tree at a later time. This happens, for example,
when the expression is the body of a procedure definition.
I can do this with semantic predicates, providing a "don't evaluate"
alternative for each expression variant parallel to each
"evaluate" alternative. But I'm guessing there's a more elegant
way of doing this.  Any suggestions?

As an aside, does anyone know of a lazy version of ANTLRReaderStream,
one that consumes input only as needed, which would be useful for
interactive applications? Thanks.


More information about the antlr-interest mailing list