[antlr-interest] Re: Custom AST types in 2.7.3rc2 (C++) (more info)

Ric Klaren klaren at cs.utwente.nl
Wed Feb 25 08:50:39 PST 2004


Hi,

On Wed, Feb 25, 2004 at 03:01:58PM -0000, Simon Kellett wrote:
> I added "ASTLabelType = "RefLmpAST";" to my parser options section
> which causes the xParser.hpp to be generated with an entry:
> 
> protected:
> 	RefLmpAST returnAST;
> 
> But the C++ compiler does not know of type RefLmpAST:
> 
> "LmpParser.hpp", line 52: Error: Type name expected instead of
> "RefLmpAST".
> 
> How do I persuade the C++ code generation to add a #include of the
> header file containing *my* AST type (ie defining type RefLmpAST) ?

Add a header section see the top of examples/cpp/treewalk.g :

header {
#include "MyAST.h"
}

See also the 'Inserting Code' section of the cpp-runtime.html.

Cheers,

Ric
-- 
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
     "Evil will always triumph, because Good is dumb." ---  Spaceballs



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list