@uml
Track the {@link ParserRuleContext} objects during the parse and hook
them up using the {@link ParserRuleContext#children} list so that it
forms a parse tree. The {@link ParserRuleContext} returned from the start
rule represents the root of the parse tree.
<p>Note that if we are not building parse trees, rule contexts only point
upwards. When a rule exits, it returns the context but that gets garbage
collected if nobody holds a reference. It points upwards but nobody
points at it.</p>
<p>When we build parse trees, we are adding all of these contexts to
{@link ParserRuleContext#children} list. Contexts are then not candidates
for garbage collection.</p>
@uml Track the {@link ParserRuleContext} objects during the parse and hook them up using the {@link ParserRuleContext#children} list so that it forms a parse tree. The {@link ParserRuleContext} returned from the start rule represents the root of the parse tree.
<p>Note that if we are not building parse trees, rule contexts only point upwards. When a rule exits, it returns the context but that gets garbage collected if nobody holds a reference. It points upwards but nobody points at it.</p>
<p>When we build parse trees, we are adding all of these contexts to {@link ParserRuleContext#children} list. Contexts are then not candidates for garbage collection.</p>