forgex_dense_dfa_m Module

This module defines procedures for building a fully compiled DFA for debugging and benchmarking.



Functions

public pure function match_dense_dfa_exactly(automaton, string) result(res)

This procedure reads a text, performs regular expression matching using compiled DFA, and returns .true. if it matches exactly.

Arguments

Type IntentOptional Attributes Name
type(automaton_t), intent(in) :: automaton
character(len=*), intent(in) :: string

Return Value logical

private pure function compute_reachable_state(automaton, curr) result(state_set)

This function calculates a set of possible NFA states from the current DFA state.

Read more…

Arguments

Type IntentOptional Attributes Name
type(automaton_t), intent(in) :: automaton
integer, intent(in) :: curr

Return Value type(nfa_state_set_t)

private pure function move(automaton, curr) result(res)

This function returns the dfa transition object, that contains the destination index and the corresponding set of transitionable NFA state.

Arguments

Type IntentOptional Attributes Name
type(automaton_t), intent(in) :: automaton
integer(kind=int32), intent(in) :: curr

Return Value type(dfa_transition_t)

private pure function next_state_dense_dfa(automaton, curr_i, symbol) result(dst_i)

This function returns the index of the destination DFA state from the index of the current automaton DFA state array and the input symbol.

Arguments

Type IntentOptional Attributes Name
type(automaton_t), intent(in) :: automaton
integer(kind=int32), intent(in) :: curr_i
character(len=*), intent(in) :: symbol

Return Value integer(kind=int32)


Subroutines

public pure subroutine construct_dense_dfa(automaton, curr_i)

This subroutine convert an NFA into a fully compiled DFA.

Arguments

Type IntentOptional Attributes Name
type(automaton_t), intent(inout) :: automaton
integer(kind=int32), intent(in) :: curr_i

public subroutine match_dense_dfa_including(automaton, string, from, to)

This procedure reads a text, performs regular expression matching using an automaton, and stores the string index in the argument if it contains a match.

Arguments

Type IntentOptional Attributes Name
type(automaton_t), intent(in) :: automaton
character(len=*), intent(in) :: string
integer, intent(inout) :: from
integer, intent(inout) :: to

private pure subroutine destination(automaton, curr, next, next_set)

This subroutine gets the next DFA nodes index from current index, and stores the result in next and next_set. If the DFA state is already registered, it returns the index, otherwise it returns DFA_INVALID_INDEX.

Arguments

Type IntentOptional Attributes Name
type(automaton_t), intent(in) :: automaton
integer(kind=int32), intent(in) :: curr
integer(kind=int32), intent(inout) :: next
type(nfa_state_set_t), intent(inout) :: next_set