Module dev.civl.abc

Interface ForLoopNode

All Superinterfaces:
ASTNode, BlockItemNode, LoopNode, StatementNode

public interface ForLoopNode extends LoopNode
A for loop, in addition to the expression and body that all loops possess, has an initializer and incrementer. The initializer can be either an expression or a declaration. See C11 Sec. 6.8.5.
  • Method Details

    • getInitializer

      ForLoopInitializerNode getInitializer()
      Gets the initializer part of this for loop node. Note that this is an instance of either ExpressionNode or DeclarationListNode.
    • setInitializer

      void setInitializer(ForLoopInitializerNode initNode)
      Sets the initializer part of this for loop node.
      Parameters:
      initNode - the initializer
    • getIncrementer

      ExpressionNode getIncrementer()
      Gets the incrementer part of this for loop node.
      Returns:
      incrementer
    • setIncrementer

      void setIncrementer(ExpressionNode node)
      Sets the incrementer part of this for loop node.
      Parameters:
      node - the incrementer
    • isStandard

      boolean isStandard()
      Returns whether the loop has been marked as being "standard." See setStandard(boolean) for what conditions are supposed to hold in order for this to return true.
      Returns:
      whether the loop was marked as "standard"
    • setStandard

      void setStandard(boolean isStandard)
      Mark whether the for loop is "standard" or not. A for loop is standard iff the following conditions are guaranteed to hold for all valid error-free executions (so in particular, an execution is allowed to violate one of these conditions as long as that execution is guaranteed to reach an error state such as an assertion violation): 1. The loop has an initializer expression of the form int i = a or i = a for some variable i, called the "loop variable," and some integer expression a. 2. The loop has a conditional of the form i invalid input: '<' b or i invalid input: '<'= b in which i is the loop variable and b is some integer expression. 3. If evaluating the expression b at the start of an iteration results in the value x then evaluating it at the end of the iteration should also result in the value x. 4. If the loop variable i evaluates to y at the start of an iteration, then at the end of that iteration, i should evaluate to y+1.
    • copy

      ForLoopNode copy()
      Description copied from interface: ASTNode
      Returns a deep copy of this AST node. The node and all of its descendants will be cloned. The cloning does not copy analysis or attribute information.
      Specified by:
      copy in interface ASTNode
      Specified by:
      copy in interface BlockItemNode
      Specified by:
      copy in interface LoopNode
      Specified by:
      copy in interface StatementNode
      Returns:
      deep copy of this node