RE: Bison/Yacc with Objective-C ?
RE: Bison/Yacc with Objective-C ?
- Subject: RE: Bison/Yacc with Objective-C ?
- From: Jeff Laing <email@hidden>
- Date: Tue, 9 Mar 2010 23:46:45 +0000
- Acceptlanguage: en-US
- Thread-topic: Bison/Yacc with Objective-C ?
> I haven't tried it, so this might be nonsense, but I think that YACC
> simply copies the emitted code from the source file to the final C
> file.
Yacc has to parse the emitted code enough to be able to replace references to $$, $1, etc with the corresponding tokens from the recognized grammar element. for example, a grammar I have lying around contains:
enum_mulable: enum_or_int
| '(' enum_expr ')' { $$ = $2; }
;
enum_or_int: INTEGER
| '-' INTEGER { $$ = -$2; }
| IDENT {
int value;
if (is_enum($1, &value)) {
$$ = value;
} else {
lexerror_nl("%s is not a constant",$1);
$$ = 0;
}
}
;
Yacc changes those $ expressions into references into its value stack.
Thus, Objective-C may trip it up, but then again it may not.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden