On Fri, Sep 5, 2008 at 2:36 AM, Klaas-Jan Stol <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 2, 2008 at 12:43 PM, Allison Randal <[EMAIL PROTECTED]> wrote:
>
>> Klaas-Jan Stol wrote:
>>
>>>
>>> This must make the following syntax rule illegal:
>>>
>>>  target = null
>>>
>>> because if "null" is declared as a .local, you can't know whether you want
>>> to nullify target, or want to set target's value to that of the .local
>>> variable "null".
>>>
>>> I take it this is no problem; just stick to
>>>
>>>  null target
>>>
>>> if you actually want to set target to 0/null.
>>>
>>
>> Yes, that's reasonable. The syntactic sugar was confusing in that case
>> anyway. (Seemed like you were assigning a null value to the destination
>> register, rather than nullifying the PMC in the destination register.)
>>
>> This belongs in a general category of opcodes where the standard
>> transformation of "call the opcode with the first argument stuck before an
>> '=' sign" doesn't really make sense.
>>
>> Allison
>>
>
> the problem seems to be a bit bigger than I had foreseen. The issue is that
> ops with the first operand marked as 'OUT' may be rewritten as:
> target = op [operand [, operand]*]?
>
> However, consider the following:
>
> .local pmc getstdin
>
> $P0 = getstdin
>
> How should this be resolved? is the opcode 'getstdin' meant here, or is it
> the value of the .local getstdin. This problem occurrs with all ops, not
> only with single-operand ops.
>
> kjs
>
the sugar for what can be on the left side of an equals sign needs to
be changed. simply having a first parameter with OUT isn't enough. the
same thing happens for
  $P0 = push $S1
which is legal pir syntax, but obscure at best.

ops must have some means of specifying (perhaps an attribute like
C<:returns> or C<:rvalue>?) that allows them to be on the right side
of the equals. only this class of ops allows the syntax described
above.

in the case of
  .local pmc getstdin
  ...
  $P0 = getstdin

this can be resolved because the (now) compiler knows (either during
parsing or semantic analysis) that the C<getstdin> op is not allowed
to be an rvalue and lookup C<getstdin> in the list of C<.local>s as a
fallback.
~jerry

Reply via email to