[antlr-interest] Re: C++ parser

geofuntasma wardf at sympatico.ca
Thu Jun 3 11:50:31 PDT 2004


Yeah, I think I didnt do all the steps properly to use C++ with ANTLR.
Sorry for that. However, I'm still having problems compiling. Now when
I compile, I get :

---------------------------------------------------------------
[@bash][~/ANTLR/C++ Grammar]> g++ -g -c -I/usr/local/include CPPLexer.cpp
In file included from CPP_parser.g:72,
                 from CPPLexer.cpp:2:
LineObject.hpp:123:7: warning: no newline at end of file
In file included from CPP_parser.g:75,
                 from CPPLexer.cpp:2:
var_types.h:26:46: warning: no newline at end of file

[@bash][~/ANTLR/C++ Grammar]> g++ -g -c -I/usr/local/include CPPParser.cpp
In file included from CPP_parser.g:72,
                 from CPPParser.cpp:2:
LineObject.hpp:123:7: warning: no newline at end of file
In file included from CPP_parser.g:75,
                 from CPPParser.cpp:2:
var_types.h:26:46: warning: no newline at end of file
In file included from CPPParser.cpp:2:
CPP_parser.g: In member function `void CPPParser::init()':
CPP_parser.g:227: `showTrace' undeclared (first use this function)
CPP_parser.g:227: (Each undeclared identifier is reported only once
for each function it appears in.)
---------------------------------------------------------------

Although I get warnings for CPPLexer.cpp, I still get the CPPLexer.o
file. But unfortunately it doesnt work when compiling the
CPPParser.cpp file.

Thanks in advance for your help.

Ward


--- In antlr-interest at yahoogroups.com, Tom Verbeure <hombre at g...> wrote:
> Assuming you are using a Unix-like system:
> configure --prefix=/usr/local
> make
> make install
> 
> As a result, you will get your include and lib files somewhere under
> /usr/local/. I'm not sure, but it's probably /usr/local/include/antlr
> for the include files and /usr/local/lib for the libantlr.a file.
> 
> Anyway, assuming these are the locations, then do the following:
> 
> To compile:
> g++ -g -c -I/usr/local/include MyLangLexer.cpp
> g++ -g -c -I/usr/local/include MyLangParser.cpp
> 
> To link:
> g++ -g -o MyLang MyLangLexer.o MyLangParser.o -L/usr/local/lib -lantlr
> 
> Obviously, if you have a separate file with main, you'll have to
> compile that also and include it in the link phase. But this should
> get you going.
> 
> Tom
> 
> 
> On Thu, 03 Jun 2004 17:20:11 -0000, geofuntasma <wardf at s...> wrote:
> > 
> > Well, I get too many errors that I cannot see the first lines. I tried
> > to save that doing "gcc CPPParser.cpp >> errors" but ">>" doesn't seem
> > to work with gcc.
> > 
> > I believe if, as Ric suggest, only a path problem. I really dont know
> > how to pass the path of the included antlr files to gcc, so I tried
> > copying them to /usr/include/antlr/ (it didnt existed that directory
> > so I created) but still not working.
> > 
> > Any help would be very appreciated.
> > 
> > Ward.
> >



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list