[LLVMdev] Enhancing TableGen

David A. Greene greened at obbligato.org
Tue Oct 11 13:33:21 PDT 2011


Jakob Stoklund Olesen <stoklund at 2pi.dk> writes:

> On Oct 11, 2011, at 1:07 PM, Jim Grosbach wrote:
>
>> Perhaps a minor note, but can I'd prefer we call them something other
>> than a "for loop." That implies a more procedural nature than is
>> natural for the language. TableGen is far more declarative that
>> procedural. 

Yep.

>> Even something simple like using a "for each" type syntax and
>> refering to the construct as a "for each definition" would go a long
>> way. What I want to avoid is any implication that there's a guarantee
>> for order of evaluation.

Good idea.  How about:

foreach x = [...]

I could do 

foreach x in [...]

but that requires another keyword.  Do we care?

> Another thing that needs clarification is the multiple variable
> syntax:
>
>   for x = [1, 2, 3], y = [4, 5, 6] in { … }
>
> It is not clear if you get a cross product or a 'zip'.

Che-Liang proposed a zip and I think I like that.  A cross-product can
be done with nested loops.  If the above implied a cross-product there
would be no way to do a zip and a zip is definitely useful in some
cases.

                         -Dave




More information about the llvm-dev mailing list