Interface FiniteAutomaton

Hierarchy

Properties

isEmpty: boolean

Returns whether this FA accepts the empty language meaning that it doesn't accept any words.

isFinite: boolean

Returns whether the formal language accepted by this FA contains finitely many words.

Note: Finite does not mean that all words can be iterated in practice. E.g. the set of all Unicode words with 10 or less characters contains 2.6e54 many words and can be accepted by a DFA with only 11 states.

maxCharacter: Char

The maximum character that is part of the alphabet of the words that this FA can accept.

Methods

  • Returns whether this FA accepts the given word.

    Parameters

    Returns boolean

  • Returns the string representation of this FA in the DOT format.

    The output of this function can passed to any graph visualization program. This can be a local installation or an online editor.

    By default, toUnicodeString is used to represent CharSets. It's possible to provide a custom stringify function using the charSetToString parameter.

    Parameters

    • Optional charSetToString: ((charSet: CharSet) => string)
        • (charSet: CharSet): string
        • Parameters

          Returns string

    Returns string

  • Returns the string representation of this FA in the Mermaid format.

    By default, toUnicodeString is used to represent CharSets. It's possible to provide a custom stringify function using the charSetToString parameter.

    Parameters

    • Optional charSetToString: ((charSet: CharSet) => string)
        • (charSet: CharSet): string
        • Parameters

          Returns string

    Returns string

  • Returns the AST of a regular expression that accepts the same language as this FA.

    Parameters

    Returns NoParentNode<Expression>

  • Returns a string representation of this FA.

    Returns string

  • Returns an iterable that will yield all word sets accepted by this FA. Word sets are yielded by ascending length.

    If this FA accepts infinitely many words, the iterable will never end. If this FA is finite, the iterable will end after at most 2^O(n) word sets (n = number of states).

    If you analyse the words of an FA, consider using this method instead of words. If this method yields k word sets, then words will yield up to O(k * m ^ l) words (m = number of possible characters, l = the maximum length of any of the k word sets).

    Returns Iterable<WordSet>

  • Returns an iterable that will yield all words accepted by this FA. Words are yielded by ascending length.

    If this FA accepts infinitely many words, the iterable will never end.

    Returns Iterable<Word>