- 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 ClassesModifier and TypeInterfaceDescriptionstatic final record
Block contains a list ofStmt
s 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 variousStmt
implementations.static final record
While statement is a conditional looping statement. -
Method Summary
Modifier and TypeMethodDescription<R> R
accept
(Stmt.Visitor<R> visitor) Executes this statement via the desiredStmt.Visitor
-
Method Details
-
accept
Executes this statement via the desiredStmt.Visitor
- Type Parameters:
R
- the return type- Parameters:
visitor
- theStmt.Visitor
to execute this statement- Returns:
- the return value from the executed statement
-