[il-antlr-interest: 20625] Re: [antlr-interest] a crazy problem cost me almost two days ---how can i get the return value from antlr?

2008-11-23 Thread Su Zhang
yes, i have, it has a prog_return class in the code, but it isnot the String type,do you know how can I take the value as a string out of the code? 2008/11/23 Terence Parr <[EMAIL PROTECTED]> > > On Nov 23, 2008, at 7:47 PM, Su Zhang wrote: > > Hi all, >> >> I wrote a returns [String s] in my rul

[il-antlr-interest: 20623] Re: [antlr-interest] antlr-interest not in wiki Dashboard

2008-11-23 Thread Terence Parr
On Nov 23, 2008, at 6:24 PM, George S. Cowan wrote: > Why is it that I can't search the antlr-interest archive from > http://www.antlr.org/wiki/dashboard.action > but I can search stringtemplate-interest? > > Is there a place where I can search the antlr-interest archive? hi. sure. in the supp

[il-antlr-interest: 20624] Re: [antlr-interest] a crazy problem cost me almost two days ---how can i get the return value from antlr?

2008-11-23 Thread Terence Parr
On Nov 23, 2008, at 7:47 PM, Su Zhang wrote: > Hi all, > > I wrote a returns [String s] in my rules in order to get a return > value, but when I call the function generated by the exact rule in > the main function, there is not any return value, and the type of > return value is not a Stri

[il-antlr-interest: 20622] [antlr-interest] a crazy problem cost me almost two days ---how can i get the return value from antlr?

2008-11-23 Thread Su Zhang
Hi all, I wrote a returns [String s] in my rules in order to get a return value, but when I call the function generated by the exact rule in the main function, there is not any return value, and the type of return value is not a String, and the value includes a tree structure,etc, but I define it

[il-antlr-interest: 20621] Re: [antlr-interest] gUnit su ggestion: treat Lexer and Parser errors the same

2008-11-23 Thread Leon Su
Hi George, Also don't forget to download the intermediate release gunit-1.0.4.jar I just uploaded to the wiki download page. The new version should be able to test your lexical rules as the example demonstrates on wiki. Please let me know if you find any problem. Thanks. Leon On Nov 23, 2008

[il-antlr-interest: 20620] [antlr-interest] gUnit suggestion: treat Lexer and Parser errors the same

2008-11-23 Thread George S. Cowan
In-Reply-To: <[EMAIL PROTECTED]> References: <[EMAIL PROTECTED]> Leon, I saw your gUnit changes at http://www.antlr.org/wiki/display/ANTLR3/gUnit+-+Grammar+Unit+Testing Thanks. That was a swift response. I'll start using gUnit on my project and let you know if I see any problems. On Mon,

[il-antlr-interest: 20619] [antlr-interest] antlr-interest not in wiki Dashboard

2008-11-23 Thread George S. Cowan
Why is it that I can't search the antlr-interest archive from http://www.antlr.org/wiki/dashboard.action but I can search stringtemplate-interest? Is there a place where I can search the antlr-interest archive? List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest Unsubscribe:

[il-antlr-interest: 20618] [antlr-interest] MismatchedRangeException never be raised?

2008-11-23 Thread gaochunguang
MismatchedRangeException's description is: The recognizer tried to match a range of symbols, usually characters, but could not. It tracks the minimum and maximum element in the range. I try to find what situation MismatchedRangeException be raised. My grammar is : number : Digital+; Digital : '

[il-antlr-interest: 20617] [antlr-interest] Capturing a grammar block as a string

2008-11-23 Thread Ilya Sterin
So in my grammar, I capture blocks of JSON-like structures. I don't want antlr to try to parse that structure, but rather to evaluate it as a string. Here is a sample code... define project as { "name": "some_widget", "version": "0.01-alpha" } Here is a simple grammar rule to demonstr

[il-antlr-interest: 20616] Re: [antlr-interest] a strange problem

2008-11-23 Thread Su Zhang
thanks a lot, yet there still have a minor problem in my project, when I am trying to get a return value from the program, I called in the main function,but I cannot find get the return value, does anybody see problem in my grammar? here it is: numreturns [String t] :n = Num {$t = $n

[il-antlr-interest: 20615] [antlr-interest] a strange problem

2008-11-23 Thread Su Zhang
Hi all, I encountered a very strange problem. I put a string 'read' in the grammar code, and when matching, I would like the input to match the toke ID which is defined as ('a'..'z'). Obviously, the IDshould match read, but why it cannot match, just becasue I have a hardcoded string 'read' in the g

[il-antlr-interest: 20614] Re: [antlr-interest] Creating a simple expression language

2008-11-23 Thread Ivar Refsdal
Hi, I'm also a newbie (thus everything could be wrong) so I can't help that much... But anyway: Here is a edited Expr grammar: grammar Expr; options { output=AST; ASTLabelType=CommonTree; k = 1; } prog:(stat {System.out.println($stat.tree.toStringTree());} )+ ; stat:

[il-antlr-interest: 20613] Re: [antlr-interest] Creating a simple expression language

2008-11-23 Thread James Abley
2008/11/18 James Abley <[EMAIL PROTECTED]>: > Hi all, > > Sorry, I'm still stuck with this. I have taken the sample grammar from > the book and reduced it as small as I know how currently. > > > grammar Expr; > > options { >output=AST; >ASTLabelType=CommonTree; >k = 1; > }

[il-antlr-interest: 20612] Re: [antlr-interest] how can i get a return string from the parser

2008-11-23 Thread Su Zhang
Hi Gavin but the class cannot be applied by the outside source, right? then how can get the value out of the program? i mean i want to call the function in the main function, yet it is generated in the internal class of the parser class, right? then how can i get this value in the main fuction? t

[il-antlr-interest: 20611] Re: [antlr-interest] Java Grammar

2008-11-23 Thread James Abley
2008/11/23 Gavin Lambert <[EMAIL PROTECTED]>: > At 08:11 24/11/2008, Simon wrote: > >But I've just realized that without access to the referenced > >classes (source or binary form) it is still not possible to > >do that. > > > > a.b.c.D.X.z() > > > >Where does the class name end and the fi

[il-antlr-interest: 20610] Re: [antlr-interest] how can i get a return string from the parser

2008-11-23 Thread Gavin Lambert
At 06:52 24/11/2008, Su Zhang wrote: >My program needs a string from Parser, but there is not any >function provided in the public class parser, how can I get the >string outside? I mean I want to get the string generated from >the rules of antlr(functions in parser), and I have >written "ret

[il-antlr-interest: 20609] Re: [antlr-interest] Java Grammar

2008-11-23 Thread Gavin Lambert
At 08:11 24/11/2008, Simon wrote: >But I've just realized that without access to the referenced >classes (source or binary form) it is still not possible to >do that. > > a.b.c.D.X.z() > >Where does the class name end and the field access start? >There is simply no way to answer that ques

[il-antlr-interest: 20608] Re: [antlr-interest] Java Grammar

2008-11-23 Thread Simon
Hi I'm aware that it is not possible to do this without context. That's why I keep symbol tables, all imports, ... at hand to handle those situations. Using semantic predicates it should be possible to build a meaningful AST (that is an AST with subtree nodes representing operations such

[il-antlr-interest: 20607] Re: [antlr-interest] Java Grammar

2008-11-23 Thread Yang Jiang
Hi Simon, I guess that would not be possible. Consider the following two cases, class A { static b b; } class b { static String bField; public static void main(String[] args) { A.b.bField ="s";// "A" is the type, "b.bField" field access

[il-antlr-interest: 20606] [antlr-interest] how can i get a return string from the parser

2008-11-23 Thread Su Zhang
Hi all, My program needs a string from Parser, but there is not any function provided in the public class parser, how can I get the string outside? I mean I want to get the string generated from the rules of antlr(functions in parser), and I have written "returns[String s]" to indicate that I nee

[il-antlr-interest: 20605] Re: [antlr-interest] Java Grammar

2008-11-23 Thread Johannes Luber
Simon schrieb: > I try to rephrase my question. I don't know how to handle some of the > primary constructs of the Java grammar. > > Integer.parseInt("123") > x.y(a, b) > x[12][34] > String.class > java.util.Arrays.class > > are all pretty simple to detect with a symbol table and the

[il-antlr-interest: 20604] Re: [antlr-interest] Java Grammar

2008-11-23 Thread Simon
I try to rephrase my question. I don't know how to handle some of the primary constructs of the Java grammar. Integer.parseInt("123") x.y(a, b) x[12][34] String.class java.util.Arrays.class are all pretty simple to detect with a symbol table and the information from the imports. Bu

[il-antlr-interest: 20603] Re: [antlr-interest] Write comments to templates

2008-11-23 Thread Chris Sekszczynska
Hi Gavin, in general, a good idea. This would simplify the parser. But what's about the walker? After splicing the ASTs, the walker has to expect an ^(comment ...) subtree everywhere (or at least after / before every statement). Is it possible to let the walker walk two ASTs? Synchronizatio

[il-antlr-interest: 20602] Re: [antlr-interest] Write comments to templates

2008-11-23 Thread Gavin Lambert
At 07:39 23/11/2008, Chris Sekszczynska wrote: >Now I like to write all comments occurring in the source file to >the (nearly) same position in the destination file. So I have to >pass the comments to the walker. Of cause, I could simply put the >comments into the default token stream and add "

[il-antlr-interest: 20601] [antlr-interest] Embedded actions for while-loop

2008-11-23 Thread Ahmad Al-Naimi
Hello, All the documentation provided with Antlr concentrate on the grammar and tree construction (understandably). I'm working on developing a small interpreter, and will use one of the grammars in the examples with modifications. However, I couldn't find any grammar example ready with acti