dfa

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: 3 Imported by: 0

Documentation

Overview

Package dfa implements Deterministic Finite Automaton(DFA).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DFA

type DFA struct {
	I     utils.State     // initial state
	F     mapset.Set      // accepts states
	Rules dfarule.RuleMap // transition function
}

DFA represents a Deterministic Finite Automaton.

func NewDFA

func NewDFA(init utils.State, accepts mapset.Set, rules dfarule.RuleMap) *DFA

NewDFA returns a new dfa.

func (*DFA) GetRuntime

func (dfa *DFA) GetRuntime() *Runtime

GetRuntime returns a new Runtime for simulating d transitions.

func (*DFA) Minimize

func (dfa *DFA) Minimize()

Minimize minimizes the DFA.

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime has a pointer to d and saves current state for simulating d transitions.

func NewRuntime

func NewRuntime(d *DFA) (r *Runtime)

NewRuntime returns a new runtime for DFA.

func (*Runtime) Matching

func (r *Runtime) Matching(str string) bool

Matching returns whether the string given is accepted (or not) by simulating the all transitions.

Directories

Path Synopsis
Package dfadebug provides some features to debug a dfa.
Package dfadebug provides some features to debug a dfa.
Package dfarule implements the transition function of DFA.
Package dfarule implements the transition function of DFA.

Jump to

Keyboard shortcuts

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