[antlr-interest] how to generate C++ file

J.R Karthikeyan jrk1987 at yahoo.co.in
Sat Aug 21 20:32:34 PDT 2010


Hi,

  Just want to make sure that , this means that I can't use antlr with visul 
studio 2005. Because my entire project is in visual studio 2005 and this parser 
is going to be one of the module for that project. So can you please let me know 
if I can use this with visual studio 2005.

Thanks,
Jrk



________________________________
From: J.R Karthikeyan <jrk1987 at yahoo.co.in>
To: antlr-interest at antlr.org
Sent: Sat, 21 August, 2010 6:03:38 PM
Subject: how to generate C++ file




Hi,

  I have generated C file using antlr and I tried to run those file using Visual 
studio 2005. I wrote a wrapper that will call the parser. I have attached the 
wrapper as well as lexer and parser file. I got an Error    1    fatal error 
C1010: unexpected end of file while looking for precompiled header. Did you 
forget to add '#include "stdafx.h"' to your source?    c:\documents and 
settings\kjambura\my documents\visual studio  
2005\projects\wrapper\wrapper\checkforcompileparser.c    468    I have tried 
various method. But I can't able to fix it. Can you please help me on this.

Thanks,
Jrk






________________________________
From: J.R Karthikeyan <jrk1987 at yahoo.co.in>
To: antlr-interest at antlr.org
Sent: Thu, 19 August, 2010 12:15:03 PM
Subject: Re: how to generate C++ file


Hi,

   I have tried  generating c file using Antlrworks and it generate the c file. 
Why I am asking C++ is, I need to do some custom code
in parser which require some information and hence I need to access the data 
structure which is written in C++ (basically class). 


say for  eg.
     
s  	→ CHAR '=' e
e  	→ t y 
y 	→ '+' t y 
	→ 
t 	→ p x
x 	→ '*' t 
	→ 
p	→ '('e')' 
	→ NUMBER 

where CHAR and NUMBER are tokens.
 
fragment
LETTER 	:	 ('a'..'z' | 'A'..'Z')
	;

CHAR	:	LETTER (LETTER | DIGIT | '_')+
	;

fragment
DIGIT	    : '0'..'9'
            ;

NUMBER	    : (DIGIT)+ '.' (DIGIT)+ | (DIGIT)+ 
            ;

Let say the input is i=5

Now  in 
s  	→ CHAR '=' e, When this get executed for i depending upon the Right hand 
side I need to declare the 'i' as int. I will get
what type of datatype by calling some member funtion of some class. Is it 
possible to do like this ANTLR.

Thanks,
Jrk

______________________________________________________________________________________________________________________________________

Yes - I am aware of that. ANTLRWorks is just calling the ANTLR tool  Jim  > 
-----Original Message----- > From: antlr-interest-bounces at antlr.org 
[mailto:antlr-interest- > bounces at antlr.org] On Behalf Of Alan Condit > Sent: 
Wednesday, August 18, 2010 12:54 PM > To: antlr-interest at antlr.org > Subject: 
Re: [antlr-interest] how to generate C++ file >  > Jim, >  > Actually, 
ANTLRWorks will generate the C code, it just won't let you see the > resultant 
code in ANTLRWorks. > As long as the grammar file designates the output language 
and it has the > appropriate stg files it will generate the language. I am 
currently working on > the stg templates for ObjC and I am generating the output 
files through > ANTLRWorks. >  > Alan > --- >  > Alan Condit > 1085 Tierra Ct. > 
Woodburn, OR 97071 >  > Email -- acondit at ipns.com > Home-Office (503) 
982-0906 >  > On Aug 18, 2010, at 12:00 PM, antlr-interest-request at antlr.org 
wrote: >  > > From: "Jim Idle" <jimi at temporal-wave.com> > > Date: August 17, 
2010 4:09:01 PM PDT > > To: <antlr-interest at antlr.org> > > Subject: Re: 
[antlr-interest] how to generate C++ file > > > > > > ANTLRWorks does not 
generate C code (and there is no C++ generator, it > > is C that you can compile 
as C++ if you like.) ANTLRWorks only works > > with Java for code generating 
purposes. Use the command line tool and > > Makefiles etc for C. > > > > You 
need to start with the downloadable examples and then read the > > getting 
started stuff on the wiki. > > > > Also don't forget http://antlr.markmail.org > 
> > > Jim > > > >> -----Original Message----- > >> From: antlr-interest-bounces 
at antlr.org [mailto:antlr-interest- > >> bounces at antlr.org] On Behalf Of J.R 
Karthikeyan > >> Sent: Tuesday, August 17, 2010 4:05 PM > >> To: antlr-interest 
at antlr.org > >> Subject: [antlr-interest] how to generate C++ file > >> > >> 
Hi, > >> > >>  I am using ANTLRWorks 1.4 for my project. I would like to 
generate > >> the > > C++ > >> file from this grammar. I don't find how to do 
this. Can you give me > > direction > >> in how to generate those files. > >> > 
>> Thanks, > >> Jrk 



More information about the antlr-interest mailing list