Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Simple Containment issue(too many references - how to avoid?)
Simple Containment issue [message #1063520] Thu, 13 June 2013 11:07 Go to next message
Thomas Haarhoff is currently offline Thomas Haarhoff
Messages: 8
Registered: December 2012
Location: Germany
Junior Member
Hello,
I'm trying to transform a programming language, given as a model, into another language.

It's working fine except of one problem.

i = alloca i32
store i32 0, i32* i


this code leads me to this xml model-representation.
(All of this is in a context of a function body, function definition and a program. So just a snippet)

<blocks label="entry">
   <instructions xsi:type="InstructionUse" reg_or_var="%i">
      <instruction xsi:type="Alloc">
         <type xsi:type="Predefined" type="i32"/>
      </instruction>
   </instructions>
   <instructions xsi:type="Store">
      <newtype xsi:type="Predefined" type="i32"/>
      <newvalue xsi:type="Constant"/>
      <adresstype xsi:type="Predefined" type="i32*"/>
      <adress xsi:type="NonConstantValue" name="%i"/>
   </instructions>
</blocks>

It's the representation of an AST I got from a Xtext Parser.

If I use my transformation, I want to get something like this:

<program>
   <functions name="@_Z6Memberi">
      <instructions xsi:type="MemoryInstruction" instructionType="Alloca"> 
         <instructionResult xsi:type ="Variable" name="i"/>
         <parameters>
            <Constant>
               <SimpleType type="int"/>
            </Constant>
         </parameters>
      </instructions>
      <instructions xsi:type="MemoryInstruction" instructionType="Store">
          <parameters>
            ...
          </parameters>
      </instructions>
   </functions>
</program>


That kind of structure would be nice.
But I get this:
<program>
   <functions name="@_Z6Memberi"> //this is function.0
      <localVariablesOrValues xsi:type="Variable" name="i"/> //this is localVariablesOrValues.2
      <instructions xsi:type="MemoryInstruction" instructionResult="/0/@functions.0/@localVariablesOrValues.2" parameters="/89"/>
      <instructions xsi:type="MemoryInstruction" parameters="/133 /135" instructionType="Store"/>
   </functions>
</program>
<Constant type="/90"/>            // this is parameter 89
<SimpleType type="int"/>          // this is type 90
<Constant type="/134" value="0"/> // this is parameter 133
<SimpleType type="int"/>          // this is type 134
<Variable type="/136" name="i"/>  // this is parameter 135
<SimpleType type="pointer"/>      // this is type 136


I have only 1 model file for the transformation. So is it avoidable to get these much links in the representation of the model? To be honest I want to avoid all of them.

Is it possible to get the result I want using 1 Transformation?

I hope my request isn't confusing.

Thanks,
Thomas
Re: Simple Containment issue [message #1063529 is a reply to message #1063520] Thu, 13 June 2013 11:39 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARD
Messages: 523
Registered: July 2009
Senior Member
Well this is related to your metamodel and not to ATL. ATL isn't responsible for the serialization of the model.
Re: Simple Containment issue [message #1063550 is a reply to message #1063529] Thu, 13 June 2013 12:02 Go to previous message
Thomas Haarhoff is currently offline Thomas Haarhoff
Messages: 8
Registered: December 2012
Location: Germany
Junior Member
Thank you very much.
Just checkted my give metamodel....
changed the containment at some points of need and all is fine now.
Greetings
Thomas
Previous Topic:[ATL] Rule inheritance with several 'from' elements
Next Topic:ANT Task VMException (Could not find model)
Goto Forum:
  


Current Time: Tue Oct 21 12:21:00 GMT 2014

Powered by FUDForum. Page generated in 0.03258 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software