TOC Toolkit API - v0.1.0
    Preparing search index...

    toc-toolkit/automata

    Dense immutable NFAs and DFAs with the standard constructions on regular languages and budgeted recognition. The translation and procedure packages build on it.

    • Thompson construction. Compiles a regular expression to an NFA with epsilon transitions. compileThompson also returns the exit state of each letter occurrence. (compileRegex, compileThompson)
    • Glushkov construction. Compiles a regular expression to its position automaton, which has one state for the start and one for each letter occurrence in the classical operand and no epsilon transitions. A Thompson automaton has two states for each letter and for each operator besides concatenation, so a search over subsets steps fewer, smaller sets. Boolean operators that survive normalization return a typed decline. (compileGlushkov)
    • Partial derivative automaton. Compiles a regular expression to the automaton of its Antimirov partial derivatives, whose states are concatenations of nodes of the expression. It has at most one state more than the letter occurrences, no epsilon moves, and never more states than the position automaton. The states are numbered in breadth-first order over the alphabet of the expression, and a checker that applies the same rules numbers them the same way. Boolean operators that survive normalization return a typed decline. (compileAntimirov)
    • Epsilon closure. Collects the states reachable through epsilon edges from a set of states. One Closure keeps its marks and its queue across calls, so a search that steps many subsets of one NFA allocates once. (epsilonClosure, Closure)
    • NFA simulation. Runs a word through an NFA and keeps the frames of the run. (simulateNfa, simulateSuppliedNfa, recognizeNfa)
    • DFA execution. Runs a word through a total transition table. (runDfa)
    • Subset construction. Turns an NFA into a DFA over its reachable subsets, in breadth-first order. An optional SubsetCache retains completed steps across edits and invalidates steps whose source moves or reachable epsilon edges changed. (determinize, SubsetCache)
    • Hopcroft minimization. Refines a Partition of the reachable states, from structures, with a SplitterQueue worklist that processes the smaller half of each split. It runs in O(k n log n) for n states and k symbols. The result numbers its states by breadth-first discovery in alphabet order, so two complete DFAs of one language and alphabet give equal tables, and minimalForm also returns the minimal state of each reachable original state. (minimize, minimalForm)
    • Moore minimization. Repeatedly refines accepting states by their transition signatures until the partition stops changing. (mooreMinimize, mooreMinimizeForm)
    • Brzozowski minimization. Applies reverse, determinize, reverse and determinize to obtain a minimal DFA. (brzozowskiMinimize)
    • Valmari minimization. Refines accepting-state blocks by their symbol predecessors. (valmariMinimize, valmariMinimizeForm)
    • Epsilon removal and simulation quotient. Removes epsilon edges while retaining state identities, then merges states that mutually forward-simulate one another. (removeEpsilon, simulationQuotient)
    • Regular-language analyses. Builds the transition monoid of the minimal DFA and checks aperiodicity and star-freeness with a power witness. (syntacticMonoid, isAperiodic, isStarFree)
    • Completion and complement. Adds a sink state to make a DFA total and flips its accepting states. (complete, complement)
    • Product construction. Combines two DFAs over the same alphabet for union, intersection and difference. (product)
    • Regular operations on NFAs. Builds the union, concatenation, star and reversal of NFAs. (union, concatenate, star, reverse)
    • Trimming. Keeps the states that are reachable and can reach acceptance, and contracts epsilon cycles. (trim)
    • State elimination. Converts an NFA to a regular expression by removing states of a generalized NFA in a deterministic order. (nfaToRegex, nfaToRegexWithOrder)
    • Embedding. Embeds a total DFA as an NFA with one move per state and symbol and no epsilon transitions. (nfaOfDfa)
    • Compilation from kernel machines. Compiles a checked NFA or DFA of the machine kernel into a dense automaton, and the DFA compilation sends every missing cell to one explicit rejecting sink. (compileNfa, compileDfa)
    • Decompilation. Gives a dense automaton the state and transition identities of a kernel machine and validates the result. (decompileNfa, decompileDfa, StatePrefix)
    • Automaton dumps. Print an NFA or a DFA as stable text. (dumpNfa, dumpDfa)
    • Step explanation. Describes a stage of a construction in words. (explainStep)
    • Dense NFA. Stores the alphabet, the start state, accepting flags, epsilon successor lists and one sorted successor list for each state and symbol. (Nfa)
    • Flat-table DFA. Stores a total transition table in which the target of state q on symbol a is table[q * alphabet.length + a]. (Dfa)
    • Automaton builders. Open, started and consumed facades that retain state insertion order. (NfaBuilder, DfaBuilder, StartedNfaBuilder, StartedDfaBuilder)
    • Run frames. The retained states of an NFA run. (NfaFrame, NfaRun, nfaFrameDecoder)
    • Enumerations. Name the closed sets of strings that the types and the wire data of the package use. (ProductKind, StageStep)