next up previous contents index
Next: External tools Up: Control Statements Previous: Termination statements

Assignment statements

The language supports two different types of assignments. The := operator   is used to assign a variable.
$\vartriangleright$ Example 10:

   x := 1 
   str := "hello"

The second kind of assignment <-   is used to replace a fortran code (i.e. a AST) by another code. Its left hand side is not necessary a variable
   

$\vartriangleright$ Example 11:Replacement of the step of a DO loop statement by the constant 2

   stat.STEP <- PARSEEXPR("2")

$\vartriangleright$ Example 12:Replacement of the selected statement by 'print *,100'

   

   $cstat <- PARSESTAT("~~~~~~~~~print *,100")

  $\vartriangleright$ Remark: When the left hand side of the AST assignment is a variable name, this variable is assigned with the AST. So, there is an important difference between the expression ($cstat) and the variable $cstat. For example, the previous transformation is equivalent to the following:

 
   tmp := PARSESTAT("   ~~~~~~~~~print *,1") 
   ($cstat) <- tmp 
    $cstat := tmp



Yann Mevel
1999-04-30