State
InterpreterState dataclass
InterpreterState()
Bases: Generic[FrameType]
Interpreter state.
This class represents the state of the interpreter. It contains the stack of frames for the interpreter. The stack of frames is used to store the current state of the interpreter during interpretation.
current_frame property
current_frame: FrameType
Get the current frame.
Returns:
Name | Type | Description |
---|---|---|
FrameType | FrameType | The current frame. |
depth class-attribute
instance-attribute
depth: int = field(
default=0, kw_only=True, init=False, repr=False
)
stack depth of the interpreter.
pop_frame
pop_frame() -> FrameType
Pop a frame from the stack.
Returns:
Name | Type | Description |
---|---|---|
FrameType | FrameType | The frame that was popped. |
Source code in src/kirin/interp/state.py
54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
push_frame
push_frame(frame: FrameType) -> FrameType
Push a frame onto the stack.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame(FrameType) | The frame to push onto the stack. | required |
Returns:
Name | Type | Description |
---|---|---|
FrameType | FrameType | The frame that was pushed. |
Source code in src/kirin/interp/state.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|