On Tue, Sep 2, 2008 at 2:28 PM, Allison Randal <[EMAIL PROTECTED]> wrote:

> Klaas-Jan Stol wrote:
>
>>
>> So, preferably, the special words in PIR will be allowed as identifiers
>> ('if','unless', 'null') and PIR will DWIM. What about the type
>> identifiers:
>> int, num, pmc, string; should these be allowed as identifiers? The
>> currently
>> special PIR words such as if, unless, null are ops, and as opnames are
>> allowed as identifiers, allowing 'if', 'unless' and 'null' makes sense.
>> The
>> type names on the other hand, are not related to PASM code, so I'd vote to
>> have them as 'reserved' words; but I'd just like to check now.
>>
>
> AFAIK, you can never use a variable in any position where you can use a
> type name. So, you can't declare a variable named 'foo' and then use it as a
> type:
>
>    .local string foo
>  * .local foo thingy # (* not valid syntax)
>
> And also, you can't use a type name as a variable, if you haven't actually
> declared a variable of that name:
>
>  * pmc = "hello" # (* not valid syntax)
>
> So, there's no reason this couldn't be valid syntax, because there's no
> ambiguity:
>
>    .local pmc pmc
>    pmc = new "String"
>    pmc = "hello"
>
>  (maybe the
>> general feeling is that there must be no reserved words in PIR...)
>>
>
> Not "no reserved words" just "the smallest set of reserved words possible",
> which means not reserving words we don't need to reserve.


I see.

>
>
> I'm not clear on why we need to reserve 'if', 'unless' and 'null' either,
> since they never appear in locations that could be confused with variables.


there's not a strict reason, no. In fact, it would be possible to allow
them, although the implementation of that will require a number of special
cases in the grammar (but doable, as far as my experiments showed me). The
only concern would be (as Andrew indicated as well), that you could write:

if null null goto goto

if you had declared null and goto as .locals.

>
>
> Allison


kjs

Reply via email to