[antlr-interest] return value struct from start rule not generated when OUTPUT=AST not specified

Douglas Godfrey douglasgodfrey at gmail.com
Wed Nov 3 11:58:02 PDT 2010


The following code does not generate the return value struct for the start rule:
robotC_Parser_robotC_parser_return_struct. The return value XmlNodeTreePtr
cannot be accessed by the main program.

If output=AST is specified, the return value struct is generated and
un-needed code is also generated to build an AST that will not be
used.

parser grammar robotC_Parser;

options
{
	language=C;
	k=1;
	tokenVocab=robotC_Lexer;
}
//	output=AST;
//	ASTLabelType=pANTLR3_BASE_TREE;


////////////////////////////////////////////////////////////////////////////////////////////////////

// P a r s e r   R u l e s

robotC_parser[SymbolTablePtr pThisPtr] returns[XmlNode * XmlNodeTreePtr]
	options {k=1;}
	:
	rule body
	;


More information about the antlr-interest mailing list