nfabuilder

package
v0.0.0-...-d9f2893 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package nfabuilder implements some structures and functions to construct NFA.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fragment

type Fragment struct {
	I     utils.State // initial state
	F     mapset.Set  // accept states
	Rules nfarule.RuleMap
}

Fragment represents a fragment of NFA to construct a larger NFA.

func NewFragment

func NewFragment() *Fragment

NewFragment returns a new Fragment.

func (*Fragment) AddRule

func (frg *Fragment) AddRule(from utils.State, c rune, next utils.State)

AddRule add a new transition rule to the Fragment. Rule concept: State(from) -->[Symbol(c)]--> State(next)

func (*Fragment) Build

func (frg *Fragment) Build() *nfa.NFA

Build converts NFA fragments into a NFA, and returns it.

func (*Fragment) CreateSkeleton

func (frg *Fragment) CreateSkeleton() (Skeleton *Fragment)

CreateSkeleton returns a nfa fragment which has same transition rule as original fragment has. The initial state and accept state is set to default.

func (*Fragment) MergeRule

func (frg *Fragment) MergeRule(frg2 *Fragment) (synthesizedFrg *Fragment)

MergeRule returns a new NFA fragment into which the transition rules of original fragment and the fragment given in the argument are merged.

Jump to

Keyboard shortcuts

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