Farkle


DFABuild Module

Functions to generate Deterministic Finite Automata from `Regex`es. The algorithm is a modified edition of the one found at ยง3.9.5 in "Compilers: Principles, Techniques and Tools" by Aho, Lam, Sethi & Ullman.

Functions and values

Function or value Description

buildRegexesToDFA prioritizeFixedLengthSymbols caseSensitive regexes

Full Usage: buildRegexesToDFA prioritizeFixedLengthSymbols caseSensitive regexes

Parameters:
    prioritizeFixedLengthSymbols : bool - Whether to prioritize regexes that don't have stars over those that do in case of a conflict.
    caseSensitive : bool - Whether the resulting DFA is case-sensitive.
    regexes : (Regex * DFASymbol) list - The list of regexes, paired with the symbol they recognize.

Returns: Result<ImmutableArray<DFAState>, BuildError list> An immutable array of the DFA states or a list of the errors that were encountered.

Builds a DFA that recignizes one of the given regexes.

prioritizeFixedLengthSymbols : bool

Whether to prioritize regexes that don't have stars over those that do in case of a conflict.

caseSensitive : bool

Whether the resulting DFA is case-sensitive.

regexes : (Regex * DFASymbol) list

The list of regexes, paired with the symbol they recognize.

Returns: Result<ImmutableArray<DFAState>, BuildError list>

An immutable array of the DFA states or a list of the errors that were encountered.

InsufficientExecutionStackException One of the regexes was extremely deep and complex to be handled by Farkle.

buildRegexesToDFAEx ct options prioritizeFixedLengthSymbols caseSensitive regexes

Full Usage: buildRegexesToDFAEx ct options prioritizeFixedLengthSymbols caseSensitive regexes

Parameters:
    ct : CancellationToken - Used to cancel the operation.
    options : BuildOptions - Used to further configure the operation.
    prioritizeFixedLengthSymbols : bool - Whether to prioritize regexes that don't have stars over those that do in case of a conflict.
    caseSensitive : bool - Whether the resulting DFA is case-sensitive.
    regexes : (Regex * DFASymbol) list - The list of regexes, paired with the symbol they recognize.

Returns: Result<ImmutableArray<DFAState>, BuildError list> An immutable array of the DFA states or a list of the errors that were encountered.

Builds a DFA that recignizes one of the given regexes.

ct : CancellationToken

Used to cancel the operation.

options : BuildOptions

Used to further configure the operation.

prioritizeFixedLengthSymbols : bool

Whether to prioritize regexes that don't have stars over those that do in case of a conflict.

caseSensitive : bool

Whether the resulting DFA is case-sensitive.

regexes : (Regex * DFASymbol) list

The list of regexes, paired with the symbol they recognize.

Returns: Result<ImmutableArray<DFAState>, BuildError list>

An immutable array of the DFA states or a list of the errors that were encountered.

OperationCanceledException ct was triggered.
InsufficientExecutionStackException One of the regexes was extremely deep and complex to be handled by Farkle.

parseRegexString

Full Usage: parseRegexString

Returns: RegexParserFunction
Returns: RegexParserFunction