From: Wu Zhou <woodzltc@cn.ibm.com>
To: Daniel Jacobowitz <drow@false.org>
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] New testcase to evaluate Fortran substring expression
Date: Fri, 15 Jul 2005 05:25:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.63.0507141043090.7735@wks190384wss.cn.ibm.com> (raw)
In-Reply-To: <20050714234612.GA21620@nevyn.them.org>
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
next prev parent reply other threads:[~2005-07-15 5:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-06-22 4:02 Wu Zhou
2005-07-03 18:57 ` Daniel Jacobowitz
2005-07-09 3:12 ` Wu Zhou
2005-07-14 23:46 ` Daniel Jacobowitz
2005-07-15 5:25 ` Wu Zhou [this message]
2005-07-15 11:49 ` Wu Zhou
2005-08-01 2:12 ` Daniel Jacobowitz
2005-08-01 4:44 ` Wu Zhou
2005-08-01 6:23 ` Mark Kettenis
2005-08-02 3:10 ` Daniel Jacobowitz
2005-08-02 10:16 ` Wu Zhou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.63.0507141043090.7735@wks190384wss.cn.ibm.com \
--to=woodzltc@cn.ibm.com \
--cc=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox