Module Simula

Class WhileStatement


public final class WhileStatement extends Statement
While Statement.
 
 Simula Standard: 4.3 While-statement
 
   while-statement = WHILE Boolean-expression DO Statement

 
Link to GitHub: Source File.
Author:
SIMULA Standards Group, Øystein Myhre Andersen
  • Field Details

    • condition

      private final Expression condition
      The WHILE condition
    • doStatement

      private final Statement doStatement
      The statement after DO
  • Constructor Details

    • WhileStatement

      WhileStatement(int line)
      Create a new WhileStatement.
      Parameters:
      line - the source line number
  • Method Details

    • doChecking

      public void doChecking()
      Description copied from class: SyntaxClass
      Perform semantic checking.

      This must be redefined in every subclass.

      Overrides:
      doChecking in class SyntaxClass
    • doJavaCoding

      public void doJavaCoding()
      Description copied from class: SyntaxClass
      Output Java code.
      Overrides:
      doJavaCoding in class Statement
    • isWhileTrueDo

      private boolean isWhileTrueDo()
      Check if this while statement is a 'while true do'.
      Returns:
      true if this while statement is a 'while true do'
    • printTree

      public void printTree(int indent)
      Description copied from class: SyntaxClass
      Utility print syntax tree method.
      Overrides:
      printTree in class SyntaxClass
      Parameters:
      indent - number of spaces leading the lines
    • toString

      public String toString()
      Overrides:
      toString in class Object