pure recursive subroutine generate_nfa_concatenate(tree, idx, nfa_graph, nfa_top, entry, exit)
implicit none
type(tree_t), intent(in) :: tree
type(nfa_state_node_t), allocatable, intent(inout) :: nfa_graph(:)
integer(int32), intent(in) :: idx
integer(int32), intent(inout) :: nfa_top
integer(int32), intent(in) :: entry
integer(int32), intent(in) :: exit
integer(int32) :: node1
call make_nfa_node(nfa_top)
if (is_exceeded(nfa_top, nfa_graph)) then
call reallocate_nfa(nfa_graph)
end if
node1 = nfa_top
call generate_nfa(tree, tree%nodes(idx)%left_i, nfa_graph, nfa_top, entry, node1)
call generate_nfa(tree, tree%nodes(idx)%right_i, nfa_graph, nfa_top, node1, exit)
end subroutine generate_nfa_concatenate