Chal Chale apne Ghar schrieb: > Hi Johannes, > One more thinig i woudl like to say that in my very first mail, i had > tested this Grammer with Antlr version 2.7.5. Then alos it was throwing > me Token StreamException as below mentioned: > > D:\Actuate\Samplelexer-parser\ConversionTool>java antlr.Tool >> vb_org.txt >> ANTLR Parser Generator Version 2.7.5 (20050128) 1989-2005 >> jGuru.com >> error: Token stream error reading grammar(s): >> vb_org.txt:45:7: expecting ''', found 'p' >> TokenStreamException: expecting ''', found 'p' >> > regards, > Gunjan
Sorry, I've never used ANTLR 2.7.7 or even 2.7.7 (which you should try yourself in case it's a runtime bug), so I can't help you there. ANTLRworks works only for ANTLR 3 upwards. Johannes > > On Wed, Feb 4, 2009 at 12:20 PM, Johannes Luber <[email protected] > <mailto:[email protected]>> wrote: > > Chal Chale apne Ghar schrieb: > > > > > > Hi Gavin, > > Thanks for quick Response. > > It was really helpful to me. > > After trying with the antlr v3 , I am getting different error in > console. > > You are using the syntax for ANTLR 2.7.7 which is mostly incompatible > with the one used by ANTLR 3. The general form of a grammar is: > > /** This is a grammar doc comment */ > grammar-type grammar name; > options { name1 = value; name2 = value2; ... } > import delegateName1=grammar1, ..., delegateNameN=grammarN; // can omit > delegateName > tokens { token-name1; token-name2 = value; ... } > scope global-scope-name-1 { «attribute-definitions» } > scope global-scope-name-2 { «attribute-definitions» } > ... > @header {...} > @lexer::header {...} > @members {...} > > «rules» > > To set the superclass of the generated class, use the superClass option. > > See > > <http://www.antlr.org/wiki/display/ANTLR3/ANTLR+v3+printable+documentation> > for further information. Although I'm really wondering how ANTLRworks > didn't complain about the fact, that you are actually using a ANTLR 2 > grammar. I suggest that you either convert the grammar to the new syntax > or just use ANTLR 2.7.7. > > Johannes > > > > D:\Actuate\Samplelexer-parser\ConversionTool>java org.antlr.Tool > > D:\Actuate\VB\v > > b_org.g > > ANTLR Parser Generator Version 3.1.1 > > error(100): D:\Actuate\VB\vb_org.g:1:1: syntax error: antlr: > > D:\Actuate\VB\vb_or > > g.g:1:1: unexpected token: class > > warning(149): D:\Actuate\VB\vb_org.g:0:0: rewrite syntax or operator > > with no out > > put option; setting output=AST > > error(150): grammar file D:\Actuate\VB\vb_org.g has no rules > > error(100): D:\Actuate\VB\vb_org.g:0:0: syntax error: assign.types: > > <AST>:0:0: u > > nexpected end of subtree > > error(100): D:\Actuate\VB\vb_org.g:0:0: syntax error: define: > <AST>:0:0: > > unexpec > > ted end of subtree > > i am attching my .g file fro reference. > > Any help would be appriciated. > > regards, > > Gunjan > > On Tue, Feb 3, 2009 at 1:23 AM, Gavin Lambert > <[email protected] <mailto:[email protected]> > > <mailto:[email protected] <mailto:[email protected]>>> wrote: > > > > At 21:45 2/02/2009, Chal Chale apne Ghar wrote: > > > > D:\Actuate\Samplelexer-parser\ConversionTool>java antlr.Tool > > vb_org.txt > > ANTLR Parser Generator Version 2.7.5 (20050128) 1989-2005 > > jGuru.com > > error: Token stream error reading grammar(s): > > vb_org.txt:45:7: expecting ''', found 'p' > > TokenStreamException: expecting ''', found 'p' > > > > as seen, i am getting TokenStream Exception. But when i am > using > > AntlrWorks to check the Grammer syntax, it is showing > correct to me. > > > > > > You're running ANTLR v2 on the command line, but ANTLRWorks is for > > ANTLR v3. To run ANTLR v3, you need to use "org.antlr.Tool", not > > "antlr.Tool". > > > > Also, by convention grammar files have a .g extension. This > doesn't > > really matter (ANTLR will still happily compile the file > regardless > > of extension), but it's a good idea to follow the convention, > since > > that's what tools are expecting. > > > > > > > > > > > ------------------------------------------------------------------------ > > > > > > 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "il-antlr-interest" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/il-antlr-interest?hl=en -~----------~----~----~----~------~----~------~--~---
