Exemplo n.º 1
0
def exo_aba_factor():
    A = NFA({0}, {3}, {(0, 'a', 0), (0, 'b', 0), (0, 'a', 1), (1, 'b', 2),
                       (2, 'a', 3), (3, 'a', 3), (3, 'b', 3)},
            name="_aba_").visu()
    A.dfa().visu().mini().visu()
    A.h**o({'b': "cde", 'a':'A'}).visu()\
        .h**o({'d': ""}).visu().rm_eps().trim().visu()\
        .dfa().visu().mini().visu()
Exemplo n.º 2
0
def nondet_vulgarise():
    NFA.VISULANG = 0
    # NFA.VISUSIZE = False
    A = NFA({0}, {3}, {(0, 'a', 0), (0, 'b', 0), (0, 'a', 1), (1, 'a', 2),
                       (1, 'b', 2), (2, 'a', 3), (2, 'b', 3)},
            name="a__").visu()

    A.run("bababa", used_states=False, labeljust="c")
    A.dfa(pdf=NFA.VISUPDF).visu()
Exemplo n.º 3
0
def exo_explosive_det():
    A = NFA({0}, {3}, {(0, 'a', 0), (0, 'b', 0), (0, 'a', 1), (1, 'a', 2),
                       (1, 'b', 2), (2, 'a', 3), (2, 'b', 3)},
            name="a__").visu()
    # B = NFA.spec("""
    # 0
    # 3
    # 0 a 0 b 0 a 1
    # 1 a 2 b 2
    # 2 a 3 b 3
    # """,name='B').visu()
    # print(A)
    # A.table()
    A.texvisu("0 > 1 > 2 > 3")
    A.run("abaabbaaababb")
    # Ad = A.dfa().visu(pdfname="export.pdf")#.texvisu("0 / 1 \n 0 \ 2",renum=True)
    A.dfa(pdf=NFA.VISUPDF).visu()  #.table()