The forgex_automaton_m
module contains automaton_t
definition and its type-bound procedures.
This type contains an NFA graph, and the DFA graph that are derived from it.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
type(segment_t), | public, | allocatable | :: | all_segments(:) | |||
type(dfa_graph_t), | public | :: | dfa | ||||
type(nfa_state_set_t), | public | :: | entry_set | ||||
integer(kind=int32), | public | :: | initial_index | = | DFA_NOT_INIT | ||
type(nfa_graph_t), | public | :: | nfa | ||||
integer(kind=int32), | public | :: | nfa_entry | ||||
integer(kind=int32), | public | :: | nfa_exit | ||||
type(tree_t), | public | :: | tree |
procedure, public :: construct => automaton__construct_dfa | |
procedure, public :: destination => automaton__destination | |
procedure, public :: epsilon_closure => automaton__epsilon_closure | |
procedure, public :: free => automaton__deallocate | |
procedure, public :: get_reachable => automaton__compute_reachable_state | |
procedure, public :: init => automaton__initialize | |
procedure, public :: move => automaton__move | |
procedure, public :: preprocess => automaton__build_nfa | |
procedure, public :: print => automaton__print_info | |
procedure, public :: print_dfa => automaton__print_dfa | |
procedure, public :: register_state => automaton__register_state |
This function calculates a set of possible NFA states from the current DFA state by the input
character symbol
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(in) | :: | self | |||
integer(kind=int32), | intent(in) | :: | curr_i | |||
character(len=*), | intent(in) | :: | symbol |
This function returns the dfa transition object, that contains the destination index and the corresponding set of transitionable NFA state.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(in) | :: | self | |||
integer(kind=int32), | intent(in) | :: | curr | |||
character(len=*), | intent(in) | :: | symbol |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(inout) | :: | self | |||
type(tree_t), | intent(in) | :: | tree |
This subroutine gets the destination index of DFA nodes from the current index with given symbol, adding a DFA node if necessary.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(inout) | :: | self | |||
integer(kind=int32), | intent(in) | :: | curr_i | |||
integer(kind=int32), | intent(inout) | :: | dst_i | |||
character(len=*), | intent(in) | :: | symbol |
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(inout) | :: | self |
This subroutine gets the next DFA nodes index from current index and symbol,
and stores the result in next
and next_set
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(in) | :: | self | |||
integer(kind=int32), | intent(in) | :: | curr | |||
character(len=*), | intent(in) | :: | symbol | |||
integer(kind=int32), | intent(inout) | :: | next | |||
type(nfa_state_set_t), | intent(inout) | :: | next_set |
Compute the ε-closure for a set of NFA states.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(inout) | :: | self | |||
type(nfa_state_set_t), | intent(inout) | :: | closure | |||
integer, | intent(in) | :: | n_index |
This subroutine reads tree
and tree_top
variable, constructs the NFA graph,
and then initializes the DFA graph.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(inout) | :: | self |
This subroutine prints DFA states and transitions to a given unit number.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(in) | :: | self | |||
integer(kind=int32), | intent(in) | :: | uni |
This subroutine provides the automata' summarized information.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(in) | :: | self |
This subroutine takes a nfa_state_set_t
type argument as input and register
the set as a DFA state node in the DFA graph.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(automaton_t), | intent(inout) | :: | self | |||
type(nfa_state_set_t), | intent(in) | :: | state_set | |||
integer(kind=int32), | intent(inout) | :: | res |