stacks

package
v0.0.0-...-4c44063 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2024 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// InitialLabelStackHeight is the initial length of stack
	InitialLabelStackHeight = 10
)
View Source
const (
	// InitialOperandStackHeight is the initial length of the OperandStack
	InitialOperandStackHeight = 1024
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Label

type Label struct {
	Arity          int
	EndPC          uint64
	ContinuationPC uint64
}

Label acts as a signal on the workflow of the control instr

type Stack

type Stack[T any] struct {
	Values []T
	Ptr    int
}

func NewLabelStack

func NewLabelStack() *Stack[*Label]

NewLabelStack creates a new LabelStack

func NewOperandStack

func NewOperandStack() *Stack[uint64]

NewOperandStack creates a new OperandStack with no limit

func (*Stack[T]) Drop

func (s *Stack[T]) Drop()

Drop is same to Pop but no return

func (*Stack[T]) Peek

func (s *Stack[T]) Peek() T

Peek will return the value on current Ptr like Pop but Ptr does not get backspace

func (*Stack[T]) Pop

func (s *Stack[T]) Pop() T

Pop will return the value on current Ptr, and backspace the Ptr

func (*Stack[T]) Push

func (s *Stack[T]) Push(val T)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL