[antlr-interest] "context sensitivity" of tree parsing
Benjamin Shropshire
shro8822 at vandals.uidaho.edu
Mon Mar 3 14:22:17 PST 2008
Loring Craymer wrote:
> You have discovered the two possible options--replicate rules or use a state flag--for single pass processing. There are also cases where it is possible to do something with StringTemplates, and you can add in a tree walker pass that prunes the subtrees for which you do not want to execute actions. If you are doing complicated analysis, the extra tree walker pass can be the best solution (and it may turn out not be an extra pass)--it never hurts to simplify.
>
> --Loring
>
Ironic, this /is/ in an extra pass (build symbol table on pass 1, uses
symbol table on pass 2). The issue arises because symbols are syntactic
rather than lexical constructs and the same rule's apply to both the
syntax of the deceleration and to the syntax of the usage.
Anyway, thanks.
More information about the antlr-interest
mailing list