Interface Stmt

All Known Implementing Classes:
Stmt.Block, Stmt.Expression, Stmt.Function, Stmt.If, Stmt.Return, Stmt.Val, Stmt.Var, Stmt.While

@NullMarked public interface Stmt
Stmt represents a piece of code that performs an action or controls the flow of the program.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final record 
    Block contains a list of Stmts that are executed in their own scope.
    static final record 
    Expression statement evaluates an expression.
    static final record 
    Function statement declares a function in the current scope with desired parameters and body.
    static final record 
    If statement is a conditional branching statement.
    static final record 
    Return statement exits a function or method while optionally returning a value for the caller to use.
    static final record 
    Val statement declares a constant in the current scope with an initializer.
    static final record 
    Var statement declares a variable in the current scope with an optional initializer.
    static interface 
    Defines operations for the various Stmt implementations.
    static final record 
    While statement is a conditional looping statement.
  • Method Summary

    Modifier and Type
    Method
    Description
    <R> R
    accept(Stmt.Visitor<R> visitor)
    Executes this statement via the desired Stmt.Visitor
  • Method Details

    • accept

      <R> R accept(Stmt.Visitor<R> visitor)
      Executes this statement via the desired Stmt.Visitor
      Type Parameters:
      R - the return type
      Parameters:
      visitor - the Stmt.Visitor to execute this statement
      Returns:
      the return value from the executed statement