[Swift-devel] a different way to do array/structure accesses

Ben Clifford benc at hawaga.org.uk
Wed Jun 27 15:46:12 CDT 2007


I've been playing round with converting the .xml intermediate format to 
be more strictly XML and less a mixture of XML and various other syntaxes.

One thing that comes out of this is that its simpler in the parser and 
compiler layer to generate array and structure accesses using a bunch of 
karajan level calls, like this:

  <print>
    <parallel>
      <getfield path="a"><vdl:getfield var="{foo}" /></getfield>
    </parallel>
  </print>

and

  <vdl:setfieldvalue>
    <argument name="var">
      <getfield path="a"><vdl:getfield var="{foo}" /></getfield>
    </argument>
    <argument name="value">
      <number>9091</number>
    </argument>
  </vdl:setfieldvalue>


instead of the way its done at the moment with a path syntax, like this:

  <vdl:setfieldvalue path="a" var="{foo}" value="9091"/>

and

  <print>
    <parallel>
      <vdl:getfield var="{foo}" path="a"/>
    </parallel>
  </print>


This allows a bunch of simplification to happen with path handling in the 
swift code. However, it makes the Karajan intermediate code more 
complicated. From the language side of things, I'd like to make this 
change, but I don't know enough about how that effects the load on 
Karajan, especially with the insanely large source files that people are 
machine-generating.


(here's the program I pulled these from:

type mytype { int a; int b; }

mytype foo;

foo.a=9091;

foo.b=818;

print(foo.a);

)

-- 


-- 



More information about the Swift-devel mailing list