[antlr-interest] 回复: Re: Problem to run Beta 4

Jim Idle jimi at intersystems.com
Wed Sep 20 09:41:16 PDT 2006


If you are getting the java outputs, then it is indeed working. the locale thing is because Ter has added support for languages/locations other than English (not the yanks actually speak that ;-) and the US. 

What this message is saying is that your computer has it's locale set to something for which  locale specific messages have yet to be written. I am sure that if you were willing to translate the English messages into your native language, that this would be useful. However we would of course have no way to know whether you had translated "Syntax error" into "Go stick your head in a fish". 

To select the output language, two things need to happen:

1) The latest .stg file for that language needs to be in the jar. I believe that the C# one is in the release you are using, but I had better let the author of the C# implementation comment on that I think;
2) Your grammar needs to specify the output language thus:

grammar mygrammar;

options {
	language=<target>;
}

For instance:

options {
	language=C;
}

Will select the C output. For C#, use:

language=CSharp;



However, on the latest version I get:

C:\Temp>java org.antlr.Tool t.g
ANTLR Parser Generator   Early Access Version 3.0b5 (??, 2006)  1989-2006
internal error: problem parsing group <unknown>: line 1:4: expecting '\n', found
 '\r' : line 1:4: expecting '\n', found '\r'
org.antlr.stringtemplate.language.GroupLexer.nextToken(Unknown Source)
antlr.TokenBuffer.fill(TokenBuffer.java:69)
antlr.TokenBuffer.LA(TokenBuffer.java:80)


Which suggests that the templates for CSharp are in a form that is confusing ANTLR. Maybe it is just my local build though - try it and see. It might be that the current release is just slightly too early for targets other than java. I know that the C output is about right but not quite and that the current C distribution (which I am about to announce) requires the templates in the current source snapshot for instance.

In other words, you may need to wait for the next RC, but you atl teast have things hanging together now.

Jim


-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of ??? Jigang (Robert) Sun
Sent: Tuesday, September 19, 2006 2:44 PM
To: antlr-interest at antlr.org
Subject: [antlr-interest] 回复: Re: Problem to run Beta 4

I put the three .jar files into my working directory, my DOS batch file contains:

path=d:\j2sdk1.4.2_05\bin
java -cp antlr-30b4.jar;stringtemplate-23b9.jar;antlr-276.jar org.antlr.Tool ep.g

excuting the .bat file:

D:\MiniClean\Clean>path=d:\j2sdk1.4.2_05\bin

D:\MiniClean\Clean>java -cp antlr-30b4.jar;stringtemplate-23b9.jar;antlr-276.jar org.antlr.Too
l ep.g
no such locale file org/antlr/tool/templates/messages/zh.stg retrying with English locale
ANTLR Parser Generator   Early Access Version 3.0b4 (??, 2006)  1989-2006

D:\MiniClean\Clean>

I am not sure if it is successful, for "no such locale file.." is echoed, nevertherless it has
produced parser and lexer file, they are .java files. What I want is c# target. Could anyone give
me a quick guidance? Unlike v2 grammar, I have not found a "options { language  = "CSharp";} "
switch permitted in v3 grammar.

Thanks.

Jigang  


--- John Vanderburg <johnvms11 at yahoo.com>写道:

> I have Beta 4 install in C:\antlr\30b4  and use the following .bat file to run the antlr.Tool
>  
>  
> @echo off
> set
>
CP=C:\antlr\30b4\lib\antlr-3.0b4.jar;C:\antlr\30b4\lib\antlr-2.7.6.jar;C:\antlr\30b4\lib\stringtemplate-2.3b9.jar;%CLASSPATH%
> set cmd=java -classpath "%CP%" org.antlr.Tool %*
> echo %cmd%
> %cmd%
> set CP
>  
> I have CLASSPATH set as an environment variable (Right click on My Computer, Click on the
> Advanced Tab and edit System Variables), as follows (note the '.' at the beginning of the line):
>  
> .;C:\Program Files\Java\jre1.5.0_06\lib\ext\QTJava.zip
>  
>  
> Also, I wasn't able to get the C# target to work, so I've been using Java to test with.  I use
> the following .bat file to 
>  
> The file is called antlrv3jc.bat
>  
> @echo off
> set
>
CP=C:\antlr\30b4\lib\antlr-3.0b4.jar;C:\antlr\30b4\lib\antlr-2.7.6.jar;C:\antlr\30b4\lib\stringtemplate-2.3b9.jar;%CLASSPATH%
> set cmd=javac -classpath "%CP%" %1 
> echo %cmd%
> %cmd%
> set CP=
> 
>  
> Hope this helps
>  
> 
>  
> John Vanderburg, johnvms11 at yahoo.com
> 
> "Why prolong the agony? All men must die."
> - Roger Waters, 5:01 AM (The Pros and Cons of Hitchhiking) 
> 
> 
> 
> ----- Original Message ----
> From: 孙纪刚 Jigang (Robert) Sun <sunjigang1965 at yahoo.com.cn>
> To: antlr-interest at antlr.org
> Sent: Tuesday, September 19, 2006 11:15:14 AM
> Subject: [antlr-interest] Problem to run Beta 4
> 
> 
> I tried variuos windows dos commands to run v3 beta4, one of the example is
> 
> D:\MiniClean\Clean>path=d:\j2sdk1.4.2_05\bin
> 
> D:\MiniClean\Clean>set classpath=D:\minifram\antlr-3.0b4\lib\antlr-2.7.6.jar;D:\minifram\antlr
> -3.0b4\lib\antlr-3.0b4.jar;D:\minifram\antlr-3.0b4\src\org\antlr
> 
> D:\MiniClean\Clean>java  D:\minifram\antlr-3.0b4\src\org\antlr.Tool par.g
> 
> 
> Error message:
> 
> Exception in thread "main" java.lang.NoClassDefFoundError: D:\minifram\antlr-3/0b4\src\org\ant
> lr/Tool
> 
> I have downloaded and extracted beta 4 onto D:\minifram\.
> 
> Could anyone give me an idea?  I am not a java user, so I have this kind of problems.
> 
> Thanks.
> 
> Jigang
> 
> 
> 
> 
>         
> ___________________________________________________________ 
> 抢注雅虎免费邮箱-3.5G容量,20M附件! 
> http://cn.mail.yahoo.com



	

	
		
___________________________________________________________ 
Mp3疯狂搜-新歌热歌高速下
http://music.yahoo.com.cn/?source=mail_mailbox_footer

-- 
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.5/450 - Release Date: 9/18/2006
 

-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.405 / Virus Database: 268.12.5/451 - Release Date: 9/19/2006
 


More information about the antlr-interest mailing list