inst

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2022 License: BSD-3-Clause Imports: 2 Imported by: 3

Documentation

Index

Constants

View Source
const (
	CHAR  = iota // CHAR instruction op code: match a byte in the range [X, Y] (inclusive)
	SPLIT        // SPLIT instruction op code: split jump to both X and Y
	JMP          // JMP instruction op code: jmp to X
	MATCH        // MATCH instruction op code: match the string
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Inst

type Inst struct {
	Op uint8
	X  uint32
	Y  uint32
}

Inst represents an NFA byte code instruction

func New

func New(op uint8, x, y uint32) *Inst

New creates a new instruction

func (Inst) Serialize

func (i Inst) Serialize() (s string)

Serialize outputs machine readable assembly

func (Inst) String

func (i Inst) String() (s string)

String humanizes the byte code

type Slice

type Slice []*Inst

Slice is a list of NFA instructions

func (Slice) Serialize

func (is Slice) Serialize() (s string)

Serialize outputs machine readable assembly

func (Slice) String

func (is Slice) String() (s string)

String humanizes the byte code

Jump to

Keyboard shortcuts

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