Exemplo n.º 1
0
def executer(input_file, output_file):
    global graph, set_terminal, set_non_terminal, first_table, follow_table, root

    get_data_follow(input_file)

    print "<-----------START----------------->"

    generate_LL1_parser_table()

    result_str = prepare_output()

    write_to_file.write_output(filename=output_file,
                               inp=result_str,
                               typer="str")
Exemplo n.º 2
0
def executer(input_file, output_file):
    global graph, set_terminal, set_non_terminal

    data = read_file(input_file)

    classify_terminals_non_terminals(data)

    graph, root = construct_graph(data)

    elem_left_recursion(graph)

    result_str = prepare_output(graph)

    write_to_file.write_output(filename=output_file,
                               inp=result_str,
                               typer="str")
Exemplo n.º 3
0
def executer(input_follow1, input_misc2, output_file):
    global graph, correspondance_dic, follow_pos, root, seed, nodes

    create_data_structures(input_follow1, input_misc2)

    generate_DFA_graph()

    print graph

    print nodes

    result_str = prepare_output()

    write_to_file.write_output(filename=output_file,
                               inp=result_str,
                               typer="str")
Exemplo n.º 4
0
def executer(input_file, output_file):
    global graph, set_terminal, set_non_terminal, first_table, augmented_dic, root

    get_data(input_file)

    augmented_dic = generate_follow_variables()

    #print augmented_dic

    create_follow_table = gen_follow_table(root)

    result_str = prepare_output()

    write_to_file.write_output(filename=output_file,
                               inp=result_str,
                               typer="str")
Exemplo n.º 5
0
def executer(input_file, input_string, output_file):
    global graph, set_terminal, set_non_terminal, first_table, follow_table, root, log

    ll1_table_follow_and_l_recursion_removal(input_file)

    data = read_file(input_string)

    data = data.strip()

    parse_result = parse_input(data)

    #result_str = prepare_output()

    if parse_result == True:
        print "Accepted"
    else:
        print "Error in parsing!!"

    write_to_file.write_output(filename=output_file, inp=log, typer="str")
Exemplo n.º 6
0
def executer(input_file, output_file):
    global graph, set_terminal, set_non_terminal, first_table, follow_table, root
    '''Example output format -

    {'Y': {')': '@', '+': '@', '*': '*T', '$': '@'}, 'X': {')': '@', '+': '+E', '$': '@'}, 'E': {'i': 'TX', '(': 'TX'}, 'T': {'i': 'iY', '(': '(E)'}}
    
    it means that Matrix M has M[Y][')'] = 'Y -> @'  
  '''

    #get_data_follow(input_file)

    follow_and_l_recursion_removal(input_file)

    print "<-----------START----------------->"

    generate_LL1_parser_table()

    result_str = prepare_output()

    write_to_file.write_output(filename=output_file,
                               inp=result_str,
                               typer="str")
Exemplo n.º 7
0
def executer(input_file, input_string, output_file):
    global graph, set_terminal, set_non_terminal, first_table, follow_table, root, log, serial_productions, action_table, goto

    get_data_parser_table(input_file)

    data = read_file(input_string)

    data = data.strip()

    print data

    parse_result = parse_input(data)

    print log
    #print ok
    #result_str = prepare_output()

    if parse_result == True:
        print "Accepted"
    else:
        print "Error in parsing!!"

    write_to_file.write_output(filename=output_file, inp=log, typer="str")