[antlr-interest] Re: C++ parser

geofuntasma wardf at sympatico.ca
Thu Jun 3 08:33:15 PDT 2004


I'm having the same problem. The message I got exactly at the
beginning is: 

-------------------------------------------------------------------
[@bash][~/ANTLR/C++ Grammar]> java antlr.Tool CPP_parser.g
ANTLR Parser Generator   Version 2.7.3   1989-2004 jGuru.com
CPP_parser.g:1222: warning:nondeterminism upon
CPP_parser.g:1222:     k==1:COMMA
CPP_parser.g:1222:    
k==2:"typedef","enum",ID,"extern","inline","_inline","__inline","virtual","explicit","friend","_stdcall","__stdcall","auto","register","static","mutable","const","const_cast","volatile","char","wchar_t","bool","short","int","_int64","__int64","long","signed","unsigned","float","double","void","_declspec","__declspec",LPAREN,"struct","union","class",SCOPE
CPP_parser.g:1222:     between alt 1 and exit branch of block
-------------------------------------------------------------------

As you can see the ANTLR version I have is 2.7.3 and I've just checked
the grammar and it seems to be the version 2 :

----------------------------------------------------------------
/* 2003
 * Version 2
 * This is version 2 of the C++ grammar definition for ANTLR to 
 *  generate lexer and parser in C++ code updated by
 *  David Wigg ....
----------------------------------------------------------------

However there is no specification for what ANTLR versions supports. So
I really dont know the source of the problem. I wanna add that the
CPPParser and CPPLexer files (.cpp and .hpp) are created. But, when I
tried to do: "gcc CPPParser.cpp", I got all the errors having an
"include CPPParser.hpp" statement in them.

Thanks in advance for your help.

Ward.
wardf(at)sympatico.ca



--- In antlr-interest at yahoogroups.com, Ric Klaren <klaren at c...> wrote:
> Hi,
> 
> On Thu, Mar 04, 2004 at 01:45:33PM -0000, navneetarvind wrote:
> > I'm completely new to parsing...
> > 
> > I've been trying to get the C++ parser put up on teh website to work 
> > with ANTLR...but it keeps throwing up errors in the "CPPParser.g" 
> > file..  
> > 
> > I dunno if its a coincidence but all the files that throw up these 
> > errors have an "include CPPParser.hpp" statement in them...
> 
> Did you run antlr on the .g files first ? (in the right order if there's
> more than one) I'm not really familiar with the grammar on the website.
> 
> > I'm running VC++ 6.0.  
> 
> Some more information would be helpfull if it's not the above. Like
antlr
> version used. And what exact error.
> 
> If you're new to parsing then starting with a C++ grammar is
probably not
> the best approach. You got one of the meanest languages to parse there.
> Starting with the antlr examples and Terence's lectures (linked
somewhere
> on antlr.org) is probably a less frustrating start.
> 
> Cheers,
> 
> Ric
> -- 
>
-----+++++*****************************************************+++++++++-------
>     ---- Ric Klaren ----- j.klaren at u... ----- +31 53 4893722  ----
>
-----+++++*****************************************************+++++++++-------
>      Human beings, who are almost unique in having the ability to learn
>    from the experience of others, are also remarkable for their apparent
>          disinclination to do so. --- Douglas Adams, Last Chance to See




 
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