Module Simula

Class GotoStatement


public final class GotoStatement extends Statement
Goto Statement.
 
 Simula Standard: 4.5 Goto-statement
 
  goto-statement = GOTO designational-expression
                 | GO TO designational-expression

 
Java does not support labels like Simula. The Java Virtual Machine (JVM), however, has labels. A JVM-label is simply a relative byte-address within the byte-code of a method. We will use Java's exception handling together with byte code engineering to re-introduce goto in the Java Language. This is done by generating Java-code which is prepared for Byte Code Engineering.

See Mapping Simula to Java (runtime design) Sect. 6.1 Goto Statement

Link to GitHub: Source File.

Author:
SIMULA Standards Group, Øystein Myhre Andersen
  • Field Details

    • label

      private final Expression label
      The target label.
  • Constructor Details

    • GotoStatement

      GotoStatement(int line)
      Create a new GotoStatement.
      Parameters:
      line - source line
  • 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
    • 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