[antlr-interest] Problems with Cpp target

Gokulakannan Somasundaram gokul007 at gmail.com
Fri Oct 12 17:09:22 PDT 2012


Hi,
   It looks like you have done everything correctly. Can you send me a
sample grammar also, which you find not working for you?

Thanks,
Gokul.

On Tue, Oct 9, 2012 at 5:47 PM, Damir Franusic <df at release14.org> wrote:

> Hi
>
> I don't know the current state of Cpp target but I was also having
> issues before so I just used C target instead and had no issues ever since.
>
>
> *Damir Franusic*
> Founder / Lead developer
>
> r14 logo
> *Release 14*
> e: df at release14.org
> p: +385-91-209-1311
> p: +971-52-840-1063
> w: http://www.release14.org/
>
>
> On 10/09/2012 11:39 AM, Alexander Polovtcev wrote:
> > Hello.
> >       I'm making a parser, which uses antlr c++ target. But when I try to
> > compile the project, I get the following error:
> > /Method 'get_tokSource' could not be resolved//
> > /I do everything the same as in the examples. Here is the code:/
> >
> > main.cpp:
> >
> > /#include<iostream>
> > #include "panlangGrammarLexer.hpp"
> > #include "panlangGrammarParser.hpp"
> >
> > using namespace std;
> >
> > int main(int argc, char *argv[]) {
> >       ANTLR_UINT8* fName;
> >       if (argc<  2 || argv[1] == NULL) {
> >           cout<<"Specify file to parse"<<endl;
> >           return 1;
> >       } else {
> >           fName    = (ANTLR_UINT8*)argv[1];
> >       }
> >
> >       panlangGrammarLexerTraits::InputStreamType input(fName,
> > ANTLR_ENC_8BIT);
> >       panlangGrammarLexer lexer(&input);
> >       panlangGrammarParserTraits::TokenStreamType
> > tstream(ANTLR_SIZE_HINT, lexer.get_tokSource());
> >       panlangGrammarParser parser(&tstream);
> >
> >       parser.program();
> >
> >       return 0;
> > }
> >
> > /beginning of the grammar:/
> >
> > grammar panlangGrammar;
> >
> > options {
> >     language = Cpp;
> >     k = 4;
> > }
> >
> > @parser::includes
> > {
> >       #include "panlangGrammarLexer.hpp"
> > }
> >
> > @lexer::traits
> > {
> >       class panlangGrammarLexer;
> >       class panlangGrammarParser;
> >       typedef antlr3::Traits<panlangGrammarLexer, panlangGrammarParser>
> > panlangGrammarLexerTraits;
> >       typedef panlangGrammarLexerTraits panlangGrammarParserTraits;
> > }
> >
> > 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
>


More information about the antlr-interest mailing list