From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6390 invoked by alias); 15 Jul 2005 05:25:38 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 6365 invoked by uid 22791); 15 Jul 2005 05:25:33 -0000 Received: from ausmtp01.au.ibm.com (HELO ausmtp01.au.ibm.com) (202.81.18.186) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 15 Jul 2005 05:25:33 +0000 Received: from sd0208e0.au.ibm.com (d23rh904.au.ibm.com [202.81.18.202]) by ausmtp01.au.ibm.com (8.12.10/8.12.10) with ESMTP id j6F4H36D187126 for ; Fri, 15 Jul 2005 14:17:19 +1000 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.250.243]) by sd0208e0.au.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j6F4HCif159434 for ; Fri, 15 Jul 2005 14:17:14 +1000 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.12.11/8.13.3) with ESMTP id j6F4EGoE011552 for ; Fri, 15 Jul 2005 14:14:17 +1000 Received: from [9.181.134.93] ([9.181.134.93]) by d23av02.au.ibm.com (8.12.11/8.12.11) with ESMTP id j6F4EDJe011448; Fri, 15 Jul 2005 14:14:14 +1000 Date: Fri, 15 Jul 2005 05:25:00 -0000 From: Wu Zhou To: Daniel Jacobowitz cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] New testcase to evaluate Fortran substring expression In-Reply-To: <20050714234612.GA21620@nevyn.them.org> Message-ID: References: <20050703185733.GI13811@nevyn.them.org> <20050714234612.GA21620@nevyn.them.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-SW-Source: 2005-07/txt/msg00130.txt.bz2 On Thu, 14 Jul 2005, Daniel Jacobowitz wrote: > First of all, why do you need four operators? I'd just use one, and > push some sentinel value for the empty boundary case. I'm not sure if > you can use NULL in this context, but if you can, that'd work nicely. I ever tried to use NULL, but it can't distinguish between ":exp" and "exp:". But I am thinking of adding one longcst into operator OP_F90_RANGE to indicate the range type, 0 refer to ":", 1 refer to "exp:", "-1" means ":exp" and 2 means "exp:exp". Or add two boolean to indicate whether that bound is empty or not. What is your point on this. I will try to do some tests soon. > > ! arglist : subrange > > ! { } > > ; > > > > IIRC empty actions can just be skipped. Do you means that I need to delete this empty action? I see others keep this. So I did this too. > > ! arglist : arglist ',' arglist %prec ABOVE_COMMA > > { arglist_len++; } > > ; > > > > The old grammar was: > arglist: /* empty */ > | exp > | substring > | arglist ',' exp > substring: exp ':' exp > > So "1, 1" "1:1", "1:1,1", "1:1,1,1" were all valid arglists. I don't > know Fortran, but I'm guessing this is intended, for multidimensional > arrays? They are not valid expression for multi-dimensional array. I guess it is might be the fault of the original author. This grammar was adapted from the C parser. (You have a look at the header of f-exp.y for proof). In C parser, it is just used to expression Function argments list. But in fortran, things are somewhat complicated: parentheses are also express array subscript, substring and also array section (the latter is the F90 extension). I guess the case is that the original author just add substring as a valid arglist and didn't notice that it might interpret "1:1,1", "1:1,1,1" and such as valid too. > > The new grammar is: > arglist : /* empty */ > | exp > | subrange > | arglist ',' arglist My intention is to use this to allow such things like "1:3, 2", "1:3, 2, 2:5" and so on. It is somewhat awesome to have to use "1:3, 2:2" or "1:3, 2:2, 2:5". > > subrange : exp ':' exp > | exp ':' > | ':' exp > | ':' > > One big problem here: I would have assumed bison would have bumped up > the number of conflicts reported here. Maybe it doesn't because of the > %prec. But you probaby don't want arglist ',' arglist. It has all > sorts of quirks; for instance, it allows "," as an arglist with two > elements. If what you are trying to do is allow "1:1, 1:1" then you > want: Yes, I ever had some thought about that. If you really care, I can drop my grammar, and accept yours. > > arglist : /* empty */ > | exp > | subrange > | arglist ',' exp > | arglist ',' subrange > Thanks very much for your kind comments. Regards - Wu Zhou