[antlr-interest] Some C target issues

Jim Idle jimi at temporal-wave.com
Tue Apr 1 12:53:53 PDT 2008


4) I checked this by modifying the example grammar LangDumpDecl as follows:

 

decls 

@declarations

{

      int jimwashere;

}

: ^(DECL type declarator+)

...

 

Then I generated the code and everythign worked as expected:

 

static void

decls(pLangDumpDecl ctx)

{   

    

      int jimwashere;

...

 

Are you sure that you are using the @declarations section correctly? It is a rule level section, not a file level section, so if you put it in the wrong place, it will be accepted by the ANTLR Tool as a valid section name, but nothing will happen to it. I'll check the docs and make sure that this is clear....

 

As well as the @init section, which C programmers should use to initialize their local variables, the C target provides the @declarations section, which is also a rule based section...

 

Perhaps this is not what is happening to you though?

 

Jim

 

 

From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Chris Snyder
Sent: Tuesday, April 01, 2008 11:03 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] Some C target issues

 

Hello,

 

1) Is there a default ASTLabelType=[?] to get rid of this warning? 

warning(152): tree grammar MScriptToBlock has no ASTLabelType option

 

2) Following the guidelines here: http://www.antlr.org/api/C/index.html, in my Tree grammar I tried changing 

 

@header {

#include <string.h>

#include <string.h>

#include <iostream.h>

}

 

To this

 

@parser::includes {

#include <string.h>

#include <iostream.h>

}

 

And I get this error:

error(143): unknown or invalid action scope for tree grammar: parser

 

@parser::header also failed with the same error

 

3) The last version of code I have from 3/13/2008 still had this warning

y:\t_vec_cots\include\antlr3\antlr3defs.h(75) : warning C4005: '_CRT_SECURE_NO_DEPRECATE' : macro redefinition

 

4) I tried using the @declarations section in my tree grammar and although no warnings were generated none of the code in the @declarations section was added to either the generated C or h files.

 

 

Thanks,

Chris

 

T-VEC Technologies, Inc.

 



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080401/d1a25eb2/attachment-0001.html 


More information about the antlr-interest mailing list