Function toString

  • Returns a human readable string representation of the given FA. The FA has to have exactly one initial state.

    All states will be labeled with numbers. The initial state will always has the number 0. Each state will be mapped to its outgoing states. The outgoing states may contain duplicates and are sorted alphabetically by their transition string. The number of states will be surrounded by brackets - square brackets for final states and round brackets for non-final states.

    A conversion function for the transitions may optionally be given. If no transition function is given, the native String function will be used.


    Example output for an NFA of a*d|bb*

    (0) -> (1) : 'a'
        -> [2] : 'b'
        -> [3] : 'd'
    
    (1) -> [3] : 'd'
    
    [2] -> [2] : 'b'
    
    [3] -> none
    

    Type Parameters

    • S

    • T

    Parameters

    • iter: FAIterator<S, Iterable<[S, T]>>
    • toString: ((value: T) => string) = String
        • (value: T): string
        • Parameters

          • value: T

          Returns string

    • ordered: boolean = false

    Returns string