That 's the problem. ANTLR generates a call to createTree: but there is no createTree: Do I have the wrong templates? Is there a bug in the template? If so, how do I update them so the generate the right code?
Rod > From what you wrote I don't see the problem. There is not '-createTree:' > there is a '-create:(id<ANTLRToken>)payload' in ANTLRBaseTreeAdaptor.h. > > Alan > > On Aug 6, 2011, at 12:00 PM, [email protected] wrote: > >> From: Rod Schmidt <[email protected]> >> Date: August 5, 2011 8:30:40 PM PDT >> To: [email protected] >> Subject: [antlr-interest] Objective-C target problem no createTree: >> >> >> I'm using the latest antlr-3.4.jar to generate an ObjC target. The target is >> generated but I'm not sure it's correct. When I build I get the following >> warning (among others): >> >> file://localhost/Users/rod/Desktop/Merlin/objc-impl/Merlin/Merlin/MerlinParser.m: >> warning: Semantic Issue: Instance method '-createTree:' not found (return >> type defaults to 'id') >> >> I'm on Mac OS X Lion and using XCode 4.1. I've also downloaded the source to >> the Objective-C runtime, etc., and there is not a createTree: method. There >> are methods such as createTree:text:, etc. but no just createTree: >> >> So at this point, I wondering. Is there a bug in the 3.4 (i.e. the templates >> are not correct), or am I just not setup right? Or is there something wrong >> with my grammar file? Here it is: >> >> grammar Merlin; >> >> options { >> language = ObjC; >> output = AST; >> >> // ANTLR can handle literally any tree node type. >> // For convenience, specify the Java type >> ASTLabelType = ANTLRCommonTree; // type of $stat.tree ref etc. >> } >> >> @memVars { >> // Map variable name to Integer object holding value >> NSMutableDictionary *memory; >> } >> >> @init { >> memory = [[NSMutableDictionary alloc] init]; >> } >> >> /** Match a series of stat rules and, for each one, print out the >> * tree stat returns, $stat.tree. toStringTree() prints the tree >> * out in form: (root child1 .. childN). ANTLR's default tree >> * construction mechanism will build a list (flat tree) of the stat >> * result trees. This tree will be the input to the tree parser. >> */ >> prog : ( stat { NSLog(@"\%@", $stat.tree == nil ? @"null" : [$stat.tree >> toStringTree]); } )+ ; >> >> stat : expr NEWLINE -> expr >> | ID '=' expr NEWLINE -> ^('=' ID expr) >> | NEWLINE -> >> ; >> >> expr : multExpr (('+'^ | '-'^) multExpr)* >> ; >> >> multExpr: atom ('*'^ atom)* >> ; >> >> atom : INT >> | ID >> | '('! expr ')'! >> ; >> >> ID : ('a'..'z' | 'A'..'Z')+ ; >> INT : '0'..'9'+ ; >> NEWLINE : '\r'? '\n' ; >> WS : (' '|'\t')+ { [self skip]; } ; >> >> If I take out the rewrite rules (i.e. all the AST generate stuff) and just >> use Objective-C code actions it works fine (lots of warnings though in the >> generated code). >> >> If anybody could shed some light on this, I would very much appreciate it. >> Otherwise I'll have to try a C target or another tool besides ANTLR, which >> I'd rather not do since ANTLR seems like the best tool out there. >> >> Thanks, >> >> Rod Schmidt >> www.infinitenil.com > > --- > > Alan Condit > 1085 Tierra Ct. > Woodburn, OR 97071 > > Email -- [email protected] > Home-Office (503) 982-0906 List: http://www.antlr.org/mailman/listinfo/antlr-interest Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address -- You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en.
