Пример #1
0
def startup(arguments):
    env = Environment()                                               # 1. create env.
    file_name_str, solution_file_name_str = read_input_string(arguments) # 2. read filenames
    ast_string, error = file_to_AST_str_no_print(file_name_str)       # 3. parse input-file to string
    if error:
        print error
    env.set_search_dir(file_name_str)
    #env.parse_config_parameter(argv)
    root = str_ast_to_python_ast(ast_string)                    # 4. parse string to python ast 
    # uncomment for profiling (e.g. performance tests)
    #import cProfile
    #cProfile.run('mch = interpret(root, env)','pyB_profile_out.txt')
    solution_file_present = not solution_file_name_str==""
    if solution_file_present:                                   # 5. parse solution-file and write to env.
        read_solution_file(env, solution_file_name_str)         # The concreate solution values are added at 
                                                                # the bmachine object-init time to the respective mch

                                                                # 6. replace defs and extern-functions inside mch and solution-file (if present)      
    parse_object = remove_defs_and_parse_ast(root, env)         # 7. which kind of ast?
    return root, env, parse_object, solution_file_present