"if" in PIR

Allison Randal allison at parrot.org
Thu Nov 13 16:36:53 UTC 2008


Klaas-Jan Stol wrote:
> On Mon, Nov 10, 2008 at 11:03 PM, chromatic <chromatic at wgz.org 
> <mailto:chromatic at wgz.org>> wrote:
>     On Monday 10 November 2008 18:09:21 Vadim Konovalov wrote:
> 
>      > Why a simple syntax sugar is not invented to introduce a couple of
>      > macro-like straightforward expansions
>      >
>      >   if COND {
>      >   }
>      >
>      > transform to
>      >
>      > unless COND goto AUTOGEN_LABEL_XXX
>      > .....
>      > AUTOGEN_LABEL_XXX:
> 
>     That moves PIR further away from a labeled, line-oriented assembly
>     language.
>     I'm not saying that's good or bad, but it's a big change.

Last I checked, those macros were not stable (particularly when 
embedding one control structure within another), and not recommended for 
general use. That could have changed.

> I understand that it might be more readable for some, but IMHO there's 2 
> reasons not to introduce this (and the 3rd is mentioned by Coke: HLLmacros):
> 1. PIR is an assembly language, albeit with a rich syntax
> 2. Long-term, PIR will not really be used *that* much; as soon as HLLs 
> are running fine on Parrot, there's little reason to program in PIR.

Also, any semantics we choose for conditional and iterator control 
structures would be a good match for some small set of HLLs, but wrong 
for all the others. The basic conditional branches give any HLL the 
tools they need to build their set of control structures, in a way that 
any other HLL can run without difficulty (under-the-hood they're all 
just simple conditional branches to labels). Being language agnostic, 
with powerful tools for building any language you want, is one of the 
core principles of Parrot.

Allison


More information about the parrot-dev mailing list