def test():
    re = generateRE()
    terminal_table = r2n.getAllTerminals(re)
    nfa = r2n.re2nfa(re)
    public.storeAsJPG(nfa.graph, 'nfa')

    transition_table, all_sets, acceptable_states = constructTransitionTable(terminal_table, nfa)
    dfa, reverse = constructDFA(transition_table, all_sets, acceptable_states)
    public.storeAsJPG(dfa.graph, 'dfa')
def judge(re, string):
    nfa = r2n.re2nfa(re)
    terminals = r2n.getAllTerminals(re)

    transition_table, all_states, acceptable_states = n2d.constructTransitionTable(terminals, nfa)
    dfa, reverse_table = n2d.constructDFA(transition_table, all_states, acceptable_states)

    min_dfa, min_reverse_table = mdfa.constructMinDFA(transition_table, all_states, dfa.first, dfa.last, terminals)
    return traversal_judge(min_dfa, min_reverse_table, string)
Exemplo n.º 3
0
def test():
    re = generateRE()
    terminal_table = r2n.getAllTerminals(re)
    nfa = r2n.re2nfa(re)
    public.storeAsJPG(nfa.graph, 'nfa')

    transition_table, all_sets, acceptable_states = constructTransitionTable(
        terminal_table, nfa)
    dfa, reverse = constructDFA(transition_table, all_sets, acceptable_states)
    public.storeAsJPG(dfa.graph, 'dfa')
def test():
    re = generateRE.generateRE()
    nfa = r2n.re2nfa(re)
    public.storeAsJPG(nfa.graph, 'nfa')
    terminals = r2n.getAllTerminals(re)

    transition_table, all_states, acceptable_states = n2d.constructTransitionTable(terminals, nfa)
    dfa, reverse_table = n2d.constructDFA(transition_table, all_states, acceptable_states)
    public.storeAsJPG(dfa.graph, 'dfa')

    mindfa, min_reverse_table = constructMinDFA(transition_table, all_states, dfa.first, dfa.last, terminals)
    public.storeAsJPG(mindfa.graph, 'min_dfa');