Class DataStack
Represents the data stack for storing operands during execution.
Inherited Members
Namespace: VM.Core.Instructions
Assembly: VM.dll
Syntax
public class DataStack
Properties
Count
Gets the number of items on the stack
Declaration
public int Count { get; }
Property Value
| Type | Description |
|---|---|
| int |
IsEmpty
Indicates whether the stack is empty
Declaration
public bool IsEmpty { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
Clear()
Clears all values from the stack
Declaration
public void Clear()
Peek()
Peeks at the top value without removing it
Declaration
public VmValue Peek()
Returns
| Type | Description |
|---|---|
| VmValue |
Exceptions
| Type | Condition |
|---|---|
| VmStackException | Thrown when stack is empty |
Pop()
Pops a value from the stack
Declaration
public VmValue Pop()
Returns
| Type | Description |
|---|---|
| VmValue |
Exceptions
| Type | Condition |
|---|---|
| VmStackException | Thrown when stack is empty |
Push(VmValue)
Pushes a value onto the stack
Declaration
public void Push(VmValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| VmValue | value |
ToString()
Returns string representation of stack contents
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |