Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Epsilon = epsilon{}
Epsilon is the ε (empty string) input.
Functions ¶
This section is empty.
Types ¶
type NFA ¶
NFA represents a Nondeterministic Finite Automaton. https://en.wikipedia.org/wiki/Nondeterministic_finite_automaton The NFA is state machine where: - A state is allowed to have multiple transitions for the same input. - The input ε (empty string) is allowed.
func (*NFA) AddTransition ¶
AddTransition adds a transition between two states on a given input. The input can be any comparable data, including Epsilon.
type NFAState ¶
type NFAState struct {
// ID of the state.
// It is assigned by the NFA and should be read-only.
ID uint32
// Transitions of the state.
// Transitions should only be added using NFA.AddTransitions.
Transitions map[any][]*NFAState
// Accept indicates that the state machine should accept/recognize the input.
// You set this yourself.
Accept bool
// Data is some user-data associated with this state.
// Your set this yourself (or don't, I don't care).
Data any
}
NFAState is a state in a NFA. NFAStates should only created using NFA.NewState().
Click to show internal directories.
Click to hide internal directories.