[antlr-interest] Dynamic scopes, pANTLR3_COMMON_TOKEN, and the C runtime

Gary R. Van Sickle g.r.vansickle at att.net
Sat Jan 3 02:24:15 PST 2009


Why does this segfault on me, and what's the proper way to do this sort of
thing?:


/// \name Tree Expressions
//@{

tree_expression
scope
{
  // A place to save a pointer to the root identifier of the tree or
subtree, so we can
  // use it further down the rule chain.
  pANTLR3_COMMON_TOKEN root;
}
	: IDENTIFIER { $tree_expression::root = $IDENTIFIER; } '('
association_list ')'
	;
	
association_list
    : association*
    ;
 
association
    : tree_expression
    | IDENTIFIER -> ^(ASSOCIATION {$tree_expression::root} IDENTIFIER)
    ;

//@}


I have an analogous construct in a different part of my grammar which does
this same thing with a pANTLR3_BASE_TREE, with no observed ill effect.

-- 
Gary R. Van Sickle



More information about the antlr-interest mailing list