def test_inp_cfg():
    """
    Simple example:
    arg1: CFG that only has two important nonterminals: WORD and SPACE
    arg2: "WORD", meaning "return all parts of input that are WORD tokens"
    """

    # -> space is included if it's part of regex ?
    # here, there is NO SPACE after the colon
    # however, each symbol must be separated by a space
    #   a space in your regex means there must be two spaces ?
    in_cfg = ("\G :\WORD \SPACE \G | \\0\n" "\WORD :\w+\n" "\SPACE : ")

    lines = [line.strip() for line in in_cfg.split('\n') if line.strip()]
    mappings = Symbol.create_mappings(lines)
def test_cfg_manual():
    """
    test:
        - create mapping from cfg expr
        - create aggregate Symbol with arithmetic and parse
    """

    in_cfg = ("\G :\WORD \SPACE \G | \\0\n" "\WORD :\w+\n" "\SPACE : ")

    lines = [line for line in in_cfg.split('\n') if line.strip()]
    mappings = Symbol.create_mappings(lines)

    sw = Symbol(mappings['WORD'])
    ss = Symbol(mappings['SPACE'])

    g = sw + ss
    g.rrec()
    #g = g | Symbol('')

    st = "first second third fourth fifth"
    g.parse(st)