Please read the API docs about the various @sections. However, make sure that 
you keep as much code as possible out of the actions in the grammar. All you 
should have is API calls to some kind of interface object, which you can 
certainly add in to the headers:

@includes
@header
@preincludes
@postinclude

See: Using Sections within Grammar Files: http://antlr.org/api/C/index.html

Use StringStream instead of FileStream. Download the examples zip file and look 
at the examples in the C directory.

Jim


> -----Original Message-----
> From: [email protected] [mailto:antlr-interest-
> [email protected]] On Behalf Of Alan Condit
> Sent: Thursday, April 01, 2010 9:03 PM
> To: [email protected]
> Subject: Re: [antlr-interest] antlr-interest Digest, Vol 65, Issue 1
> 
> Jim,
> 
> I guess the question then is how do you go about adding import header
> statements into the generated c files, so that you can use Objective C
> objects and messages in the tree handling code? I'd rather not have to
> edit them by hand everytime that I make a change to the .g file.
> 
> Also, is it possible to configure the lexer, so that you pass it a
> buffer, rather than a file stream? I currently have a lexer written in
> Objective-C that works that way, but I like the higher level lexer
> definition of antlr for ease of maintenance.
> 
> Alan
> ---
> 
> On Apr 1, 2010, at 12:00 PM, [email protected] wrote:
> 
> >  28. Objective-C and Antlr (Alan Condit)
> >  29. Re: Objective-C and Antlr (Jim Idle)
> > ------------------------------
> >
> > Message: 29
> > Date: Thu, 01 Apr 2010 08:29:36 -0700
> > From: "Jim Idle" <[email protected]>
> > Subject: Re: [antlr-interest] Objective-C and Antlr
> > To: "[email protected]" <[email protected]>
> > Message-ID: <[email protected]>
> > Content-Type: text/plain;   charset="us-ascii"
> >
> > Well, the C output is compatible with Objective C of course, but the
> ObjC target was pretty much abandoned too many years ago to be useful.
> I doubt that there is much advantage to using an objective C oriented
> target vs a straight C target to be honest.
> 
> >
> > Jim
> >
> >> -----Original Message-----
> >> From: [email protected] [mailto:antlr-interest-
> >> [email protected]] On Behalf Of Alan Condit
> >> Sent: Thursday, April 01, 2010 8:28 AM
> >> To: [email protected]
> >> Subject: [antlr-interest] Objective-C and Antlr
> >>
> >> Is there a string template to generate Objective-C from Antlr3.2? If
> >> not what version of Antlr does one need to go back to in order to
> get a
> >> version that will generate Objective-C code?
> >>
> >> Thanks,
> >> Alan
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address




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.

Reply via email to