From: Andrew Cagney <cagney@gnu.org>
To: Daniel Jacobowitz <drow@false.org>
Cc: Paul Hilfinger <hilfingr@gnat.com>, gdb-patches@sources.redhat.com
Subject: Re: [RFA] Add language-dependent post-parser
Date: Wed, 31 Mar 2004 16:49:00 -0000 [thread overview]
Message-ID: <406AF6AE.5040106@gnu.org> (raw)
In-Reply-To: <20040331153650.GA30084@nevyn.them.org>
>>>>> > > I don't see why you can't do it, for instance, here:
>>>>> > > simple_exp : simple_exp '(' arglist ')'
>>>>> > > {
>>>>> > > write_exp_elt_opcode (OP_FUNCALL);
>>>>> > > write_exp_elt_longcst ($3);
>>>>> > > /* check arguments */
>>>>> > > write_exp_elt_opcode (OP_FUNCALL);
>>>>> > > }
>>>>> > > ;
>>>
>>>> >
>>>
>>>>> > > You'd have to wiggle the expression machinery to give you back the
>>>>> > > expression node for the function name, probably by making the
>>>>> > > write_exp_* functions return a pointer. But that's less intrusive and
>>>>> > > more efficient than adding a second pass.
>>>
>>>> >
>>>> > Yes, that's exactly how I'd LIKE to do it. And I would, but for one
>>>> > miserable little fact: the expression at this point is in POSTFIX
>>>> > form. So, for example, I can't use evaluate_type or the evaluate_exp
>>>> > member of exp_descriptor, both of which work on PREFIX form.
>>
>>>
>>> How much work would it be to duplicate and prefixify them, then?
>>> prefixify_subexp has the right interface already; if you write out the
>>> OP_FUNCALL, you could then call a function which returns a new struct
>>> expression in prefix form containing just the call and its arguments.
>>> It would just need to allocate enough memory (could be generous about
>>> it and just use the size of the original expression), call
>>> prefixify_subexp, and fiddle out->nelts.
>>>
>>> OK, it's not so _efficient_, but... it could be made efficient if
>>> someone overhauls the representation at some point.
>
>
> But I guess the point is, this is no more elegant than a second pass,
> and whatever you implement I should probably use for C++ anyway so it
> won't be an Ada-specific hook. Does anyone else have an opinion?
Ok, two thoughts:
- how come it's in this compressed postfix form?
This could hardly be a memory usage problem?
- could multi-pass be better / cleaner long term?
Is there a language (that we care about) with overload semantics so
screwed up that both the containing expression and the parameters are
needed when resolving the name?
One way to get an answer is to ask: how to the corresponding compilers
(Ada, Java, ObjC, C++) all implement this?
Andrew
next prev parent reply other threads:[~2004-03-31 16:49 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-03-30 9:24 Paul Hilfinger
2004-03-30 14:27 ` Daniel Jacobowitz
2004-03-31 8:02 ` Paul Hilfinger
2004-03-31 15:30 ` Daniel Jacobowitz
2004-03-31 15:36 ` Daniel Jacobowitz
2004-03-31 16:49 ` Andrew Cagney [this message]
2004-03-31 16:58 ` Daniel Jacobowitz
2004-04-01 10:43 ` Paul Hilfinger
2004-04-02 16:25 ` Andrew Cagney
-- strict thread matches above, loose matches on Subject: below --
2004-03-19 0:09 Paul Hilfinger
2004-03-04 11:33 ` Paul Hilfinger
2004-03-19 0:09 ` Daniel Jacobowitz
2004-03-04 22:29 ` Daniel Jacobowitz
2004-03-05 8:15 ` Paul Hilfinger
2004-03-19 0:09 ` Paul Hilfinger
2004-04-02 16:33 ` Daniel Jacobowitz
2004-04-03 12:05 ` Paul Hilfinger
2004-04-07 9:32 ` Paul Hilfinger
2004-04-09 22:40 ` Daniel Jacobowitz
2004-04-10 22:12 ` Paul Hilfinger
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=406AF6AE.5040106@gnu.org \
--to=cagney@gnu.org \
--cc=drow@false.org \
--cc=gdb-patches@sources.redhat.com \
--cc=hilfingr@gnat.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