[antlr-interest] antlr-interest Digest, Vol 65, Issue 1

Jim Idle jimi at temporal-wave.com
Fri Apr 2 08:12:32 PDT 2010


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: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> bounces at antlr.org] On Behalf Of Alan Condit
> Sent: Thursday, April 01, 2010 9:03 PM
> To: antlr-interest at antlr.org
> 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, antlr-interest-request at antlr.org 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" <jimi at temporal-wave.com>
> > Subject: Re: [antlr-interest] Objective-C and Antlr
> > To: "antlr-interest at antlr.org" <antlr-interest at antlr.org>
> > Message-ID: <ae5820b41a49164fabb46295b2feef87 at temporal-wave.com>
> > 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: antlr-interest-bounces at antlr.org [mailto:antlr-interest-
> >> bounces at antlr.org] On Behalf Of Alan Condit
> >> Sent: Thursday, April 01, 2010 8:28 AM
> >> To: antlr-interest at antlr.org
> >> 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





More information about the antlr-interest mailing list