def load_bootstrap_linklet(which_str, debug, is_it_expander=False, from_fasl=True): from pycket.error import SchemeException with PerfRegion("%s-linklet" % which_str): console_log("Loading the %s linklet..." % which_str) linklet_file_path = locate_linklet("%s.rktl.linklet" % which_str) if from_fasl: try: linklet_file_path = locate_linklet("%s.zo" % which_str) except SchemeException: linklet_file_path = locate_linklet("%s.fasl" % which_str) # load the linklet _instance = load_inst_linklet(linklet_file_path, debug, set_version=is_it_expander, from_fasl=from_fasl) _instance.expose_vars_to_prim_env(excludes=syntax_primitives) if is_it_expander: from pycket.env import w_global_config w_global_config.set_config_val('expander_loaded', 1) return 0
def load_linklet_from_fasl(file_name, set_version=False): from pycket.fasl import Fasl from pycket.env import w_version from pycket.util import console_log from pycket.ast_vs_sexp import deserialize_loop debug_start("loading-linklet") debug_print("Loading linklet from fasl -- %s" % file_name) sexp = Fasl().to_sexp_from_file(file_name) version_sexp, linklet_sexp = W_String.make(""), None if set_version: version_sexp = sexp.car() linklet_sexp = sexp.cdr() else: linklet_sexp = sexp linklet = None if "zo" in file_name: linklet = deserialize_loop(linklet_sexp) else: console_log("Run pycket with --make-linklet-zos to make the compiled zo files for bootstrap linklets", 1) compile_linklet = get_primitive("compile-linklet") linklet = compile_linklet.call_interpret([linklet_sexp, W_Symbol.make("linkl"), w_false, w_false, w_false]) if set_version: ver = version_sexp.as_str_ascii() console_log("Setting the version to %s" % ver) w_version.set_version(ver) debug_stop("loading-linklet") return linklet, version_sexp
def locate_linklet(file_name): import os from pycket.error import SchemeException env_vars = os.environ.keys() if "PYTHONPATH" not in env_vars: console_log("For PyPy to work with Pycket, PYTHONPATH variable should be set in the environment.. See README", debug=True) py_paths = [""] # Try "here", wherever that is, and hope it's CWD else: python_path = os.environ["PYTHONPATH"] py_paths = python_path.split(os.path.pathsep) file_path = "" for p in py_paths: f_path = os.path.join(p, file_name) if os.path.exists(f_path): file_path = f_path break # Also try the UP (since PYTHONPATH may only point to the PyPy) up_file = os.path.join(p, os.path.join("..", file_name)) if os.path.exists(up_file): file_path = up_file break else: raise SchemeException("Can't locate the : %s" % file_name) return file_path
def rpython_fasl_to_sexp(fasl_file): from rpython.rlib import rtime from pycket.fasl import Fasl start_time = rtime.time() sexp = Fasl().to_sexp_from_file(fasl_file) console_log("rpython fasl->s-exp time : %s" % (rtime.time()-start_time), debug=True) console_log("%s" % sexp.tostring(), 1)
def make_instance(args): # name, data, *vars_vals with PerfRegion("make-instance"): name = args[0] # W_Symbol data = w_false mode = w_false from pycket.util import console_log if "'" in name.tostring(): console_log("making instance : %s" % name.tostring(), 3) else: console_log("making instance : %s" % name.tostring(), 4) if len(args) <= 2: data = args[1] vars_vals = [] else: data = args[1] mode = args[2] vars_vals = args[3:] # check if the vars and vals match if ((len(vars_vals) % 2) != 0): raise SchemeException("Variable names and values do not match : %s" % vars_vals) vars_vals_dict = {} for i in range(0, len(vars_vals), 2): n = vars_vals[i] v = vars_vals[i+1] vars_vals_dict[n] = W_LinkletVar(v, n, mode) return W_LinkletInstance(name, vars_vals_dict, data)
def load_linklet_from_fasl(file_name, set_version=False): from pycket.fasl import Fasl from pycket.env import w_version from pycket.util import console_log from pycket.ast_vs_sexp import deserialize_loop debug_start("loading-linklet") debug_print("Loading linklet from fasl -- %s" % file_name) sexp = Fasl().to_sexp_from_file(file_name) version_sexp, linklet_sexp = W_String.make(""), None if set_version: version_sexp = sexp.car() linklet_sexp = sexp.cdr() else: linklet_sexp = sexp linklet = None if "zo" in file_name: linklet = deserialize_loop(linklet_sexp) else: console_log("Run pycket with --make-linklet-zos to make the compiled zo files for bootstrap linklets", 1) compile_linklet = get_primitive("compile-linklet") linklet = compile_linklet.call_interpret([linklet_sexp, W_Symbol.make("linkl"), w_false, w_false, w_false]) if set_version: ver = version_sexp.as_str_ascii() console_log("Setting the version to %s" % ver) w_version.set_version(ver) debug_stop("loading-linklet") return linklet, version_sexp
def instantiate_linklet(linkl, import_instances, target_instance, use_prompt, env, cont): from pycket.util import console_log console_log("instantiating linklet : %s" % linkl.name.tostring(), 4) prompt = False if use_prompt is not w_false: # use-prompt? : any/c = #t - what happens when it is 3 ? prompt = True im_list, im_length = to_rpython_list(import_instances) expected = len(linkl.importss) if expected != im_length: raise SchemeException( "The number of instances in import-instances must match the number of import sets in linklet. Expected %s but got %s" % (expected, im_length)) if target_instance is w_false: target = None elif isinstance(target_instance, W_LinkletInstance): target = target_instance else: raise SchemeException( "Expected #f or instance? as target-instance, got : %s" % target_instance) with PerfRegionCPS("instantiate-linklet"): cont_ = finish_perf_region_cont("instantiate-linklet", env, cont) return linkl.instantiate(im_list, env.toplevel_env()._pycketconfig, prompt, target, env, cont_)
def make_instance(args): # name, data, *vars_vals with PerfRegion("make-instance"): name = args[0] # W_Symbol data = w_false mode = w_false from pycket.util import console_log if "'" in name.tostring(): console_log("making instance : %s" % name.tostring(), 3) else: console_log("making instance : %s" % name.tostring(), 4) if len(args) <= 2: data = args[1] vars_vals = [] else: data = args[1] mode = args[2] vars_vals = args[3:] # check if the vars and vals match if ((len(vars_vals) % 2) != 0): raise SchemeException( "Variable names and values do not match : %s" % vars_vals) vars_vals_dict = {} for i in range(0, len(vars_vals), 2): n = vars_vals[i] v = vars_vals[i + 1] vars_vals_dict[n] = W_LinkletVar(v, n, mode) return W_LinkletInstance(name, vars_vals_dict, data)
def write_linklet_bundle_hash(ht, out_port, env, cont): from pycket.util import console_log from pycket.racket_entry import get_primitive console_log("BUNDLE AST TO BE SERIALIZED: %s" % ht.tostring(), 7) with PerfRegion("ast->sexp"): l = ht.length() keys = [None] * l vals = [None] * l i = 0 for k, v in ht.iteritems(): keys[i] = k vals[i] = ast_to_sexp(v) i += 1 bundle_s_exp = make_simple_immutable_table(W_EqImmutableHashTable, keys, vals) console_log("WRITING BUNDLE SEXP : %s" % bundle_s_exp.tostring(), 7) s_exp_to_fasl = get_primitive("s-exp->fasl") with PerfRegionCPS("s-exp->fasl"): return s_exp_to_fasl.call([bundle_s_exp, out_port, values.w_false], env, finish_perf_region_cont( "s-exp->fasl", env, cont))
def load_bootstrap_linklets(debug=False, do_load_regexp=False, gen_expander_zo=False): sys_config = load_fasl(debug) load_expander(debug, gen_expander_zo) if do_load_regexp: load_regexp(debug) console_log("Bootstrap linklets are ready.") return sys_config
def racket_fasl_to_sexp(fasl_file): from pycket.prims.input_output import open_infile from rpython.rlib import rtime load_fasl() fasl_to_sexp = get_primitive("fasl->s-exp") port = open_infile(W_Path(fasl_file), "r") start_time = rtime.time() sexp = fasl_to_sexp.call_interpret([port, w_true]) console_log("racket fasl->s-exp time : %s" % (rtime.time()-start_time), debug=True) console_log("%s" % sexp.tostring(), 1)
def compile_linklet(form, name, import_keys, get_import, options, env, cont): from pycket.util import console_log console_log( "compiling linklet : %s %s\n import_keys : %s -- get_import : %s" % (name.tostring(), form.tostring(), import_keys.tostring(), get_import.tostring()), 5) with PerfRegionCPS("compile-linklet"): cont_ = finish_perf_region_cont("compile-linklet", env, cont) return do_compile_linklet(form, name, import_keys, get_import, options, env, cont_)
def load_bootstrap_linklets(debug=False, do_load_regexp=False): load_fasl(debug) load_expander(debug) if do_load_regexp: load_regexp(debug) console_log("Bootstrap linklets are ready.") return 0
def load_bootstrap_linklets(debug=False, do_load_regexp=False): load_fasl(debug) load_expander(debug) if do_load_regexp: load_regexp(debug) console_log("Bootstrap linklets are ready.") return 0
def read_linklet_cont(env, cont, _vals): from pycket.util import console_log from pycket.util import finish_perf_region bundle_map = check_one_val(_vals) finish_perf_region("fasl->s-exp") if not isinstance(bundle_map, W_HashTable): raise SchemeException("got something that is not a table: %s" % bundle_map.tostring()) console_log("BUNDLE SEXP FASL-READ from ZO: %s" % bundle_map.tostring(), 7) with PerfRegion("s-exp->ast"): return return_value(deserialize_loop(bundle_map), env, cont)
def load_inst_linklet(file_path, debug=False, set_version=False, expose_vars=False, from_fasl=False): from pycket.env import w_version linkl = None if from_fasl: linkl, _ = load_linklet_from_fasl(file_path, set_version) else: linkl = load_linklet_from_json(file_path, set_version) linkl_instance = _instantiate_linklet(file_path, linkl) if expose_vars: console_log("Exporting vars of %s" % file_path) linkl_instance.expose_vars_to_prim_env() console_log("DONE with the %s." % file_path) return linkl_instance
def load_inst_linklet(file_path, debug=False, set_version=False, expose_vars=False, from_fasl=False): from pycket.env import w_version linkl = None if from_fasl: linkl, _ = load_linklet_from_fasl(file_path, set_version) else: linkl = load_linklet_from_json(file_path, set_version) linkl_instance = _instantiate_linklet(file_path, linkl) if expose_vars: console_log("Exporting vars of %s" % file_path) linkl_instance.expose_vars_to_prim_env() console_log("DONE with the %s." % file_path) return linkl_instance
def load_bootstrap_linklet(which_str, debug, is_it_expander=False, generate_zo=False): with PerfRegion("%s-linklet" % which_str): console_log("Loading the %s linklet..." % which_str) linklet_file_path = locate_linklet("%s.rktl.linklet" % which_str) # load the linklet _instance, sys_config = load_inst_linklet_json(linklet_file_path, debug, set_version=is_it_expander, generate_zo=generate_zo) _instance.expose_vars_to_prim_env(excludes=syntax_primitives) if is_it_expander: from pycket.env import w_global_config w_global_config.set_config_val('expander_loaded', 1) return sys_config
def do_compile_linklet(form, name, import_keys, get_import, options, env, cont): from pycket.util import console_log if isinstance(form, W_WrappedConsProper): # s-expr # read it and create an AST, put it in a W_Linklet and return if not isinstance(form.car(), W_Symbol) or "linklet" != form.car().tostring(): raise SchemeException( "Malformed s-expr. Expected a linklet, got %s" % form.tostring()) else: w_name = W_Symbol.make("ad-hoc") if name is w_false else name # Process the imports w_importss = form.cdr().car() importss = get_imports_from_w_importss_sexp(w_importss) # list of directories (one for each import group) # importss_list ==> [[Import ...] ...] # Process the exports w_exports = form.cdr().cdr().car() exports = get_exports_from_w_exports_sexp(w_exports) # exports ==> {int_id:Export ...} # Process the body w_body = form.cdr().cdr().cdr() with PerfRegion("compile-sexp-to-ast"): body_forms = process_w_body_sexp(w_body, importss, exports) linkl = W_Linklet(w_name, importss, exports, body_forms) console_log("compiled linklet : %s" % (linkl.tostring()), 6) if import_keys is w_false: return return_value_direct(linkl, env, cont) else: return return_multi_vals(Values.make([linkl, import_keys]), env, cont) elif isinstance(form, W_Linklet): if import_keys is w_false: return return_value_direct(form, env, cont) else: return return_multi_vals(Values.make([form, import_keys]), env, cont) else: # correlated # take the AST from the correlated and put it in a W_Linklet and return raise SchemeException("NYI")
def read_linklet_bundle_hash(in_port, env, cont): from pycket.racket_entry import get_primitive from pycket.fasl import Fasl from pycket.util import console_log current_load_relative_dir_path = get_primitive("current-load-relative-directory").get_cell_value(cont) fasl_to_s_exp = get_primitive("fasl->s-exp") with PerfRegion("fasl->s-exp"): bundle_map = Fasl(current_load_relative_dir_path).to_sexp_from_w_port(in_port) #return fasl_to_s_exp.call([in_port, values.w_true], env, read_linklet_cont(env, cont)) if not isinstance(bundle_map, W_HashTable): raise SchemeException("got something that is not a table: %s" % bundle_map.tostring()) console_log("BUNDLE SEXP FASL-READ from ZO: %s" % deserialize_loop(bundle_map).tostring(), 7) with PerfRegion("s-exp->ast"): return return_value(deserialize_loop(bundle_map), env, cont)
def read_eval_print_string(expr_str, return_val=False, debug=False): # read sexp = racket_read_str(expr_str) # expand #expanded = racket_expand(sexp) # eval results = racket_eval(sexp) if return_val: return results # print racket_print(results) # FIXME console_log("(print (eval (read (open-input-string %s))))" % (expr_str)) return 0
def read_eval_print_string(expr_str, return_val=False, debug=False): # read sexp = racket_read_str(expr_str) # expand #expanded = racket_expand(sexp) # eval results = racket_eval(sexp) if return_val: return results # print racket_print(results) # FIXME console_log("(print (eval (read (open-input-string %s))))" % (expr_str)) return 0
def do_compile_linklet(form, name, import_keys, get_import, options, env, cont): from pycket.util import console_log if isinstance(form, W_WrappedConsProper): # s-expr # read it and create an AST, put it in a W_Linklet and return if not isinstance(form.car(), W_Symbol) or "linklet" != form.car().tostring(): raise SchemeException("Malformed s-expr. Expected a linklet, got %s" % form.tostring()) else: w_name = W_Symbol.make("ad-hoc") if name is w_false else name # Process the imports w_importss = form.cdr().car() importss = get_imports_from_w_importss_sexp(w_importss) # list of directories (one for each import group) # importss_list ==> [[Import ...] ...] # Process the exports w_exports = form.cdr().cdr().car() exports = get_exports_from_w_exports_sexp(w_exports) # exports ==> {int_id:Export ...} # Process the body w_body = form.cdr().cdr().cdr() with PerfRegion("compile-sexp-to-ast"): body_forms = process_w_body_sexp(w_body, importss, exports) linkl = W_Linklet(w_name, importss, exports, body_forms) console_log("compiled linklet : %s" % (linkl.tostring()), 6) if import_keys is w_false: return return_value_direct(linkl, env, cont) else: return return_multi_vals(Values.make([linkl, import_keys]), env, cont) elif isinstance(form, W_Linklet): if import_keys is w_false: return return_value_direct(form, env, cont) else: return return_multi_vals(Values.make([form, import_keys]), env, cont) else: # correlated # take the AST from the correlated and put it in a W_Linklet and return raise SchemeException("NYI")
def load_bootstrap_linklet(which_str, debug, is_it_expander=False, from_fasl=True): from pycket.error import SchemeException with PerfRegion("%s-linklet" % which_str): console_log("Loading the %s linklet..." % which_str) linklet_file_path = locate_linklet("%s.rktl.linklet" % which_str) if from_fasl: try: linklet_file_path = locate_linklet("%s.zo" % which_str) except SchemeException: linklet_file_path = locate_linklet("%s.fasl" % which_str) # load the linklet _instance = load_inst_linklet(linklet_file_path, debug, set_version=is_it_expander, from_fasl=from_fasl) _instance.expose_vars_to_prim_env(excludes=syntax_primitives) if is_it_expander: from pycket.env import w_global_config w_global_config.set_config_val('expander_loaded', 1) return 0
def instantiate_linklet(linkl, import_instances, target_instance, use_prompt, env, cont): from pycket.util import console_log console_log("instantiating linklet : %s" % linkl.name.tostring(), 4) prompt = False if use_prompt is not w_false: # use-prompt? : any/c = #t - what happens when it is 3 ? prompt = True im_list, im_length = to_rpython_list(import_instances) expected = len(linkl.importss) if expected != im_length: raise SchemeException("The number of instances in import-instances must match the number of import sets in linklet. Expected %s but got %s" % (expected, im_length)) if target_instance is w_false: target = None elif isinstance(target_instance, W_LinkletInstance): target = target_instance else: raise SchemeException("Expected #f or instance? as target-instance, got : %s" % target_instance) with PerfRegionCPS("instantiate-linklet"): cont_ = finish_perf_region_cont("instantiate-linklet", env, cont) return linkl.instantiate(im_list, env.toplevel_env()._pycketconfig, prompt, target, env, cont_)
def write_linklet_bundle_hash(ht, out_port, env, cont): from pycket.util import console_log from pycket.racket_entry import get_primitive console_log("BUNDLE AST TO BE SERIALIZED: %s" % ht.tostring(), 7) with PerfRegion("ast->sexp"): l = ht.length() keys = [None]*l vals = [None]*l i = 0 for k, v in ht.iteritems(): keys[i] = k vals[i] = ast_to_sexp(v) i += 1 bundle_s_exp = make_simple_immutable_table(W_EqImmutableHashTable, keys, vals) console_log("WRITING BUNDLE SEXP : %s" % bundle_s_exp.tostring(), 7) s_exp_to_fasl = get_primitive("s-exp->fasl") with PerfRegionCPS("s-exp->fasl"): return s_exp_to_fasl.call([bundle_s_exp, out_port, values.w_false], env, finish_perf_region_cont("s-exp->fasl", env, cont))
def load_inst_linklet_json(json_file_name, debug=False, set_version=False, generate_zo=False, expose_vars=False): from pycket.env import w_version debug_start("loading-linklet") debug_print("loading and instantiating : %s" % json_file_name) console_log("Loading linklet from %s" % json_file_name) linkl, sys_config = W_Linklet.load_linklet(json_file_name, set_version, generate_zo=generate_zo) debug_print("DONE with loading : %s" % json_file_name) console_log("Instantiating %s ...." % json_file_name) debug_print("Instantiating %s ...." % json_file_name) instantiate_linklet = get_primitive("instantiate-linklet") linkl_instance = instantiate_linklet.call_interpret([linkl, w_null, w_false, w_false]) debug_print("DONE Instantiating %s ...." % json_file_name) debug_stop("loading-linklet") if expose_vars: console_log("Exporting vars of %s" % json_file_name) linkl_instance.expose_vars_to_prim_env() console_log("DONE with the %s." % json_file_name) return linkl_instance, sys_config
def load_linklet(json_file_name, set_version=False): from pycket.expand import readfile_rpython, getkey, JsonLoader from pycket.util import console_log from pycket.env import w_version """ Expands and loads a linklet from a JSON file""" with PerfRegion("json-load"): data = readfile_rpython(json_file_name) json = pycket_json.loads(data) console_log("Finished reading JSON from %s" % json_file_name, 2) assert json.is_object json_python_dict = json.value_object() assert "linklet" in json_python_dict linklet_dict = getkey(json_python_dict, "linklet", type='o') assert "exports" in linklet_dict and "body" in linklet_dict # list of JsonObject exports_list = getkey(linklet_dict, "exports", type='a') if set_version: from pycket.util import console_log conf = getkey(linklet_dict, "config", type='o') ver = conf['version'].value_string() console_log("Setting the version to %s" % ver) w_version.set_version(ver) exports = {} for exp in exports_list: if exp.is_array: arr = exp.value_array() internal_str = arr[0].value_object()['quote'].value_object()['toplevel'].value_string() internal_name = W_Symbol.make(internal_str) external_name = W_Symbol.make(arr[1].value_object()['quote'].value_object()['toplevel'].value_string()) w_internal_name = Gensym.gensym(internal_str) exports[internal_name] = Export(w_internal_name, external_name) else: exp_str = exp.value_object()['quote'].value_object()['toplevel'].value_string() exp_sym = W_Symbol.make(exp_str) w_exp_sym = Gensym.gensym(exp_str) exports[exp_sym] = Export(w_exp_sym, exp_sym) imports_list = getkey(linklet_dict, "importss", type='a', default=[]) importss = [None]*len(imports_list) # list of dict if "importss" in linklet_dict: for index, imports in enumerate(imports_list): arr = imports.value_array() # bootstrap linklets have no imports at all # this is only for debugging purposes instance_imports = [] for id_str in arr: imp_str = id_str.value_object()['quote'].value_object()['toplevel'].value_string() imp_sym = W_Symbol.make(imp_str) w_imp_sym = Gensym.gensym(imp_str) instance_imports.append(Import(W_Fixnum(index), imp_sym, w_imp_sym, w_imp_sym)) importss[index] = instance_imports console_log("Converting linklet forms to AST ...", 2) loader = JsonLoader() with PerfRegion("json-to-ast"): all_forms = [] for body_form in getkey(linklet_dict, "body", type='a'): form_2 = loader.to_ast(body_form) form_1 = Context.normalize_term(form_2) form = assign_convert(form_1) all_forms.append(form) # for each exported defined id, we need to add a # variable-set! for the exported var with the defined id for exp_sym, exp_obj in exports.iteritems(): rator = ModuleVar(var_set_sym, "#%kernel", var_set_sym, None) exp_var = LinkletVar(exp_obj.int_id) top_var = ToplevelVar(exp_sym) mode = Quote(values.w_false) # FIXME: possible optimization rands = [exp_var, top_var, mode] all_forms.append(App.make(rator,rands)) linkl = W_Linklet(W_Symbol.make(json_file_name), importss, exports, all_forms) console_log("Finished converting linklet forms to AST ...", 2) config = {} config_obj = getkey(linklet_dict, "config", type='o') if config_obj is not None: for k, v in config_obj.iteritems(): config[k] = v.value_string() return linkl, config
def compile_linklet(form, name, import_keys, get_import, options, env, cont): from pycket.util import console_log console_log("compiling linklet : %s %s\n import_keys : %s -- get_import : %s" % (name.tostring(), form.tostring(), import_keys.tostring(), get_import.tostring()), 5) with PerfRegionCPS("compile-linklet"): cont_ = finish_perf_region_cont("compile-linklet", env, cont) return do_compile_linklet(form, name, import_keys, get_import, options, env, cont_)
def initiate_boot_sequence(command_line_arguments, use_compiled=False, debug=False, set_run_file="", set_collects_dir="", set_config_dir="", set_addon_dir="", compile_any=False, do_load_regexp=False): from pycket.env import w_version load_bootstrap_linklets(debug, do_load_regexp=do_load_regexp) with PerfRegion("set-params"): # These need to be set before the boot sequence if set_run_file: console_log("Setting the 'run-file path to %s" % set_run_file) set_path("run-file", set_run_file) if set_collects_dir: console_log("Setting the 'collects-dir path to %s" % set_collects_dir) set_path("collects-dir", set_collects_dir) if set_config_dir: console_log("Setting the 'config-dir path to %s" % set_config_dir) set_path("config-dir", set_config_dir) if set_addon_dir: console_log("Setting the 'addon-dir path to %s" % set_addon_dir) set_path("addon-dir", set_addon_dir) # Set the cmd arguments for racket ccla = get_primitive("current-command-line-arguments") ccla.call_interpret([W_Vector.fromelements(command_line_arguments)]) # Run "boot" to set things like (current-module-name-resolver) (o/w it's going to stay as the # "core-module-name-resolver" which can't recognize modules like 'racket/base (anything other than # things like '#%kernel really) console_log("Entering Boot Sequence") console_log("(boot)") boot = get_primitive("boot") boot.call_interpret([]) console_log("(current-library-collection-links (find-library-collection-links))") flcl = get_primitive("find-library-collection-links") lib_coll_links = flcl.call_interpret([]) clcl = get_primitive("current-library-collection-links") clcl.call_interpret([lib_coll_links]) console_log("(current-library-collection-paths (find-library-collection-paths))") flcp = get_primitive("find-library-collection-paths") lib_coll_paths = flcp.call_interpret([]) clcp = get_primitive("current-library-collection-paths") clcp.call_interpret([lib_coll_paths]) console_log("(read-accept-compiled true)") read_accept_compiled = get_primitive("read-accept-compiled") read_accept_compiled.call_interpret([w_true]) compiled_file_path = "compiled/pycket" ucfp = get_primitive("use-compiled-file-paths") if use_compiled: console_log("(use-compiled-file-paths %s)" % compiled_file_path) ucfp.call_interpret([W_WrappedConsProper.make(W_String.make(compiled_file_path), w_null)]) else: ucfp.call_interpret([w_null]) console_log("(use-compiled-file-paths null)") cctm = get_primitive("current-compile-target-machine") if compile_any: cctm.call_interpret([w_false]) # set the current directory to the current directory import os c_dir = os.getcwd() console_log("(current-directory %s)" % c_dir) # We can't call the current-directory like a primitive # because it prints a report to stdout from pycket.values_parameter import top_level_config from pycket.prims.general import current_directory_param c = top_level_config.get(current_directory_param) assert isinstance(c, W_ThreadCell) c.set(W_Path(c_dir)) console_log("...Boot Sequence Completed") from pycket.env import w_global_config as glob glob.boot_is_completed() return 0
def load_linklet(json_file_name, set_version=False): from pycket.expand import readfile_rpython, getkey, JsonLoader from pycket.util import console_log from pycket.env import w_version """ Expands and loads a linklet from a JSON file""" with PerfRegion("json-load"): data = readfile_rpython(json_file_name) json = pycket_json.loads(data) console_log("Finished reading JSON from %s" % json_file_name, 2) assert json.is_object json_python_dict = json.value_object() assert "linklet" in json_python_dict linklet_dict = getkey(json_python_dict, "linklet", type='o') assert "exports" in linklet_dict and "body" in linklet_dict # list of JsonObject exports_list = getkey(linklet_dict, "exports", type='a') if set_version: from pycket.util import console_log conf = getkey(linklet_dict, "config", type='o') ver = conf['version'].value_string() console_log("Setting the version to %s" % ver) w_version.set_version(ver) exports = {} for exp in exports_list: if exp.is_array: arr = exp.value_array() internal_str = arr[0].value_object()['quote'].value_object( )['toplevel'].value_string() internal_name = W_Symbol.make(internal_str) external_name = W_Symbol.make( arr[1].value_object()['quote'].value_object() ['toplevel'].value_string()) w_internal_name = Gensym.gensym(internal_str) exports[internal_name] = Export(w_internal_name, external_name) else: exp_str = exp.value_object()['quote'].value_object( )['toplevel'].value_string() exp_sym = W_Symbol.make(exp_str) w_exp_sym = Gensym.gensym(exp_str) exports[exp_sym] = Export(w_exp_sym, exp_sym) imports_list = getkey(linklet_dict, "importss", type='a', default=[]) importss = [None] * len(imports_list) # list of dict if "importss" in linklet_dict: for index, imports in enumerate(imports_list): arr = imports.value_array() # bootstrap linklets have no imports at all # this is only for debugging purposes instance_imports = [] for id_str in arr: imp_str = id_str.value_object()['quote'].value_object( )['toplevel'].value_string() imp_sym = W_Symbol.make(imp_str) w_imp_sym = Gensym.gensym(imp_str) instance_imports.append( Import(W_Fixnum(index), imp_sym, w_imp_sym, w_imp_sym)) importss[index] = instance_imports console_log("Converting linklet forms to AST ...", 2) loader = JsonLoader() with PerfRegion("json-to-ast"): all_forms = [] for body_form in getkey(linklet_dict, "body", type='a'): form_2 = loader.to_ast(body_form) form_1 = Context.normalize_term(form_2) form = assign_convert(form_1) all_forms.append(form) # for each exported defined id, we need to add a # variable-set! for the exported var with the defined id for exp_sym, exp_obj in exports.iteritems(): rator = ModuleVar(var_set_sym, "#%kernel", var_set_sym, None) exp_var = LinkletVar(exp_obj.int_id) top_var = ToplevelVar(exp_sym) mode = Quote(values.w_false) # FIXME: possible optimization rands = [exp_var, top_var, mode] all_forms.append(App.make(rator, rands)) linkl = W_Linklet(W_Symbol.make(json_file_name), importss, exports, all_forms) console_log("Finished converting linklet forms to AST ...", 2) config = {} config_obj = getkey(linklet_dict, "config", type='o') if config_obj is not None: for k, v in config_obj.iteritems(): config[k] = v.value_string() return linkl, config
def racket_entry(names, config, command_line_arguments): from pycket.prims.general import executable_yield_handler from pycket.values import W_Fixnum if config['make-zos']: make_bootstrap_zos() return 0 linklet_perf.init() loads, startup_options, flags = get_options(names, config) init_library = startup_options['init_library'][0] set_run_file = startup_options['set_run_file'][0] set_collects_dir = startup_options['set_collects_dir'][0] set_config_dir = startup_options['set_config_dir'][0] set_addon_dir = startup_options['set_addon_dir'][0] eval_sexp = startup_options['eval_sexp'][0] run_as_linklet = startup_options['run_as_linklet'][0] load_linklets = startup_options['load_linklets'] load_as_linklets = startup_options['load_as_linklets'] is_repl = flags['is_repl'] no_lib = flags['no_lib'] just_kernel = flags['just_kernel'] just_init = flags['just_init'] use_compiled = flags['use_compiled'] debug = flags['debug'] version = flags['version'] c_a = flags['compile_any'] do_load_regexp = flags['do_load_regexp'] dev_mode = flags['dev_mode'] if load_as_linklets: for rkt in load_as_linklets: create_linklet_json(rkt) load_inst_linklet("%s.linklet" % rkt) return 0 if load_linklets: load_linklets_at_startup(load_linklets) return 0 if dev_mode: dev_mode_entry(dev_mode, eval_sexp, run_as_linklet) return 0 with PerfRegion("startup"): initiate_boot_sequence(command_line_arguments, use_compiled, debug, set_run_file, set_collects_dir, set_config_dir, set_addon_dir, compile_any=c_a, do_load_regexp=do_load_regexp) if just_init: return 0 namespace_require = get_primitive("namespace-require") load = get_primitive("load") if just_kernel: console_log("Running on just the #%kernel") namespace_require_kernel() if not no_lib: with PerfRegion("init-lib"): init_lib = W_WrappedConsProper.make(W_Symbol.make("lib"), W_WrappedConsProper.make(W_String.make(init_library), w_null)) console_log("(namespace-require %s) ..." % init_lib.tostring()) namespace_require_plus(init_lib) console_log("Init lib : %s loaded..." % (init_library)) put_newline = False if loads: for rator_str, rand_str in loads: if rator_str == "load": # -f console_log("(load %s)" % (rand_str)) load.call_interpret([W_String.make(rand_str)]) elif rator_str == "file" or rator_str == "lib": # -t & -l require_spec = W_WrappedConsProper.make(W_Symbol.make(rator_str), W_WrappedConsProper.make(W_String.make(rand_str), w_null)) console_log("(namespace-require '(%s %s))" % (rator_str, rand_str)) namespace_require_plus(require_spec) elif rator_str == "eval": # -e console_log("(eval (read (open-input-string %s)))" % rand_str) read_eval_print_string(rand_str, False, debug) if version: from pycket.env import w_version print("Welcome to Pycket v%s" % w_version.get_version()) if is_repl: # -i put_newline = True dynamic_require = get_primitive("dynamic-require") repl = dynamic_require.call_interpret([W_Symbol.make("racket/repl"), W_Symbol.make("read-eval-print-loop")]) from pycket.env import w_global_config w_global_config.set_config_val('repl_loaded', 1) repl.call_interpret([]) if put_newline: print linklet_perf.print_report() # we just want the global value anyway eyh = executable_yield_handler.call_interpret([]) eyh.call_interpret([W_Fixnum.ZERO]) exit = get_primitive("exit") exit.call_interpret([]) return 0
def get_options(names, config): is_repl = config['repl'] no_lib = config['no-lib'] just_kernel = config['just_kernel'] just_init = config['just-init'] use_compiled = config['use-compiled'] debug = config['verbose'] version = config['version'] compile_any = config['compile-machine-independent'] do_load_regexp = config['load-regexp'] dev_mode = config['dev-mode'] load_rators = names['loads'] if 'loads' in names else [] load_rands = names['load_arguments'] if 'load_arguments' in names else [] set_run_file = names['set-run-file'] if 'set-run-file' in names else [""] set_collects_dir = names['set-collects-dir'] if 'set-collects-dir' in names else [""] set_config_dir = names['set-config-dir'] if 'set-config-dir' in names else [""] set_addon_dir = names['set-addon-dir'] if 'set-addon-dir' in names else [""] init_library = names['init-lib'] if 'init-lib' in names else ["racket/base"] # racket/init verbosity_lvl = int(names['verbosity_level'][0]) if debug else -1 verbosity_keywords = names['verbosity_keywords'] if 'verbosity_keywords' in names else [] eval_sexp = names['eval-sexp'] if 'eval-sexp' in names else [""] run_as_linklet = names['run-as-linklet'] if 'run-as-linklet' in names else [""] load_linklets = names['load-linklets'] if 'load-linklets' in names else [] load_as_linklets = names['load-as-linklets'] if 'load-as-linklets' in names else [] loads_print_str = [] loads = [] for index, rator in enumerate(load_rators): rand = load_rands[index] loads_print_str.append("(%s %s)" % (rator, rand)) loads.append((rator, rand)) log_str = """Options : loads : %s init_library : %s set-run-file : %s set-collects-dir : %s set-config-dir : %s set-addon-dir : %s eval-s-sexp : %s run-as-linklet : %s load-linklets : %s load-as-linklets : %s is_repl : %s no_lib : %s just-#%%kernel : %s just-init : %s use-compiled : %s verbosity-level : %s verbosity-keywords : %s dev-mode : %s """ % (loads_print_str, init_library[0], set_run_file[0], set_collects_dir[0], set_config_dir[0], set_addon_dir[0], eval_sexp[0], run_as_linklet[0], load_linklets, load_as_linklets, is_repl, no_lib, just_kernel, just_init, use_compiled, verbosity_lvl, verbosity_keywords, dev_mode ) console_log(log_str, debug=debug) startup_options = { 'init_library' : init_library, 'set_run_file' : set_run_file, 'set_collects_dir' : set_collects_dir, 'set_config_dir' : set_config_dir, 'set_addon_dir' : set_addon_dir, 'eval_sexp' : eval_sexp, 'run_as_linklet' : run_as_linklet, 'load_linklets' : load_linklets, 'load_as_linklets' : load_as_linklets } flags = { 'is_repl' : is_repl, 'no_lib' : no_lib, 'just_kernel' : just_kernel, 'just_init' : just_init, 'use_compiled' : use_compiled, 'debug' : debug, 'version' : version, 'compile_any' : compile_any, 'do_load_regexp' : do_load_regexp, 'dev_mode' : dev_mode } return loads, startup_options, flags
def racket_entry(names, config, command_line_arguments): from pycket.prims.general import executable_yield_handler from pycket.values import W_Fixnum if config['make-zos']: make_bootstrap_zos() return 0 linklet_perf.init() loads, startup_options, flags = get_options(names, config) init_library = startup_options['init_library'][0] set_run_file = startup_options['set_run_file'][0] set_collects_dir = startup_options['set_collects_dir'][0] set_config_dir = startup_options['set_config_dir'][0] set_addon_dir = startup_options['set_addon_dir'][0] eval_sexp = startup_options['eval_sexp'][0] run_as_linklet = startup_options['run_as_linklet'][0] load_linklets = startup_options['load_linklets'] load_as_linklets = startup_options['load_as_linklets'] is_repl = flags['is_repl'] no_lib = flags['no_lib'] just_kernel = flags['just_kernel'] just_init = flags['just_init'] use_compiled = flags['use_compiled'] debug = flags['debug'] version = flags['version'] c_a = flags['compile_any'] do_load_regexp = flags['do_load_regexp'] dev_mode = flags['dev_mode'] if load_as_linklets: for rkt in load_as_linklets: create_linklet_json(rkt) load_inst_linklet("%s.linklet" % rkt) return 0 if load_linklets: load_linklets_at_startup(load_linklets) return 0 if dev_mode: dev_mode_entry(dev_mode, eval_sexp, run_as_linklet) return 0 with PerfRegion("startup"): initiate_boot_sequence(command_line_arguments, use_compiled, debug, set_run_file, set_collects_dir, set_config_dir, set_addon_dir, compile_any=c_a, do_load_regexp=do_load_regexp) if just_init: return 0 namespace_require = get_primitive("namespace-require") load = get_primitive("load") if just_kernel: console_log("Running on just the #%kernel") namespace_require_kernel() if not no_lib: with PerfRegion("init-lib"): init_lib = W_WrappedConsProper.make(W_Symbol.make("lib"), W_WrappedConsProper.make(W_String.make(init_library), w_null)) console_log("(namespace-require %s) ..." % init_lib.tostring()) namespace_require_plus(init_lib) console_log("Init lib : %s loaded..." % (init_library)) put_newline = False if loads: for rator_str, rand_str in loads: if rator_str == "load": # -f console_log("(load %s)" % (rand_str)) load.call_interpret([W_String.make(rand_str)]) elif rator_str == "file" or rator_str == "lib": # -t & -l require_spec = W_WrappedConsProper.make(W_Symbol.make(rator_str), W_WrappedConsProper.make(W_String.make(rand_str), w_null)) console_log("(namespace-require '(%s %s))" % (rator_str, rand_str)) namespace_require_plus(require_spec) elif rator_str == "eval": # -e console_log("(eval (read (open-input-string %s)))" % rand_str) read_eval_print_string(rand_str, False, debug) if version: from pycket.env import w_version print("Welcome to Pycket v%s" % w_version.get_version()) if is_repl: # -i put_newline = True dynamic_require = get_primitive("dynamic-require") repl = dynamic_require.call_interpret([W_Symbol.make("racket/repl"), W_Symbol.make("read-eval-print-loop")]) from pycket.env import w_global_config w_global_config.set_config_val('repl_loaded', 1) repl.call_interpret([]) if put_newline: print linklet_perf.print_report() # we just want the global value anyway eyh = executable_yield_handler.call_interpret([]) eyh.call_interpret([W_Fixnum.ZERO]) exit = get_primitive("exit") exit.call_interpret([]) return 0
def initiate_boot_sequence(command_line_arguments, use_compiled=False, debug=False, set_run_file="", set_collects_dir="", set_config_dir="", set_addon_dir="", compile_any=False, do_load_regexp=False): from pycket.env import w_version load_bootstrap_linklets(debug, do_load_regexp=do_load_regexp) with PerfRegion("set-params"): # These need to be set before the boot sequence if set_run_file: console_log("Setting the 'run-file path to %s" % set_run_file) set_path("run-file", set_run_file) if set_collects_dir: console_log("Setting the 'collects-dir path to %s" % set_collects_dir) set_path("collects-dir", set_collects_dir) if set_config_dir: console_log("Setting the 'config-dir path to %s" % set_config_dir) set_path("config-dir", set_config_dir) if set_addon_dir: console_log("Setting the 'addon-dir path to %s" % set_addon_dir) set_path("addon-dir", set_addon_dir) # Set the cmd arguments for racket ccla = get_primitive("current-command-line-arguments") ccla.call_interpret([W_Vector.fromelements(command_line_arguments)]) # Run "boot" to set things like (current-module-name-resolver) (o/w it's going to stay as the # "core-module-name-resolver" which can't recognize modules like 'racket/base (anything other than # things like '#%kernel really) console_log("Entering Boot Sequence") console_log("(boot)") boot = get_primitive("boot") boot.call_interpret([]) console_log("(current-library-collection-links (find-library-collection-links))") flcl = get_primitive("find-library-collection-links") lib_coll_links = flcl.call_interpret([]) clcl = get_primitive("current-library-collection-links") clcl.call_interpret([lib_coll_links]) console_log("(current-library-collection-paths (find-library-collection-paths))") flcp = get_primitive("find-library-collection-paths") lib_coll_paths = flcp.call_interpret([]) clcp = get_primitive("current-library-collection-paths") clcp.call_interpret([lib_coll_paths]) console_log("(read-accept-compiled true)") read_accept_compiled = get_primitive("read-accept-compiled") read_accept_compiled.call_interpret([w_true]) compiled_file_path = "compiled/pycket" ucfp = get_primitive("use-compiled-file-paths") if use_compiled: console_log("(use-compiled-file-paths %s)" % compiled_file_path) ucfp.call_interpret([W_WrappedConsProper.make(W_String.make(compiled_file_path), w_null)]) else: ucfp.call_interpret([w_null]) console_log("(use-compiled-file-paths null)") cctm = get_primitive("current-compile-target-machine") if compile_any: cctm.call_interpret([w_false]) # set the current directory to the current directory import os c_dir = os.getcwd() console_log("(current-directory %s)" % c_dir) # We can't call the current-directory like a primitive # because it prints a report to stdout from pycket.values_parameter import top_level_config from pycket.prims.general import current_directory_param c = top_level_config.get(current_directory_param) assert isinstance(c, W_ThreadCell) c.set(W_Path(c_dir)) console_log("...Boot Sequence Completed") from pycket.env import w_global_config as glob glob.boot_is_completed() return 0
def get_options(names, config): is_repl = config['repl'] no_lib = config['no-lib'] just_kernel = config['just_kernel'] just_init = config['just-init'] use_compiled = config['use-compiled'] debug = config['verbose'] version = config['version'] compile_any = config['compile-machine-independent'] do_load_regexp = config['load-regexp'] dev_mode = config['dev-mode'] load_rators = names['loads'] if 'loads' in names else [] load_rands = names['load_arguments'] if 'load_arguments' in names else [] set_run_file = names['set-run-file'] if 'set-run-file' in names else [""] set_collects_dir = names['set-collects-dir'] if 'set-collects-dir' in names else [""] set_config_dir = names['set-config-dir'] if 'set-config-dir' in names else [""] set_addon_dir = names['set-addon-dir'] if 'set-addon-dir' in names else [""] init_library = names['init-lib'] if 'init-lib' in names else ["racket/base"] # racket/init verbosity_lvl = int(names['verbosity_level'][0]) if debug else -1 verbosity_keywords = names['verbosity_keywords'] if 'verbosity_keywords' in names else [] eval_sexp = names['eval-sexp'] if 'eval-sexp' in names else [""] run_as_linklet = names['run-as-linklet'] if 'run-as-linklet' in names else [""] load_linklets = names['load-linklets'] if 'load-linklets' in names else [] load_as_linklets = names['load-as-linklets'] if 'load-as-linklets' in names else [] loads_print_str = [] loads = [] for index, rator in enumerate(load_rators): rand = load_rands[index] loads_print_str.append("(%s %s)" % (rator, rand)) loads.append((rator, rand)) log_str = """Options : loads : %s init_library : %s set-run-file : %s set-collects-dir : %s set-config-dir : %s set-addon-dir : %s eval-s-sexp : %s run-as-linklet : %s load-linklets : %s load-as-linklets : %s is_repl : %s no_lib : %s just-#%%kernel : %s just-init : %s use-compiled : %s verbosity-level : %s verbosity-keywords : %s dev-mode : %s """ % (loads_print_str, init_library[0], set_run_file[0], set_collects_dir[0], set_config_dir[0], set_addon_dir[0], eval_sexp[0], run_as_linklet[0], load_linklets, load_as_linklets, is_repl, no_lib, just_kernel, just_init, use_compiled, verbosity_lvl, verbosity_keywords, dev_mode ) console_log(log_str, debug=debug) startup_options = { 'init_library' : init_library, 'set_run_file' : set_run_file, 'set_collects_dir' : set_collects_dir, 'set_config_dir' : set_config_dir, 'set_addon_dir' : set_addon_dir, 'eval_sexp' : eval_sexp, 'run_as_linklet' : run_as_linklet, 'load_linklets' : load_linklets, 'load_as_linklets' : load_as_linklets } flags = { 'is_repl' : is_repl, 'no_lib' : no_lib, 'just_kernel' : just_kernel, 'just_init' : just_init, 'use_compiled' : use_compiled, 'debug' : debug, 'version' : version, 'compile_any' : compile_any, 'do_load_regexp' : do_load_regexp, 'dev_mode' : dev_mode } return loads, startup_options, flags
def load_linklet(json_file_name, set_version=False, generate_zo=False): from pycket.expand import readfile_rpython, getkey, JsonLoader from pycket.util import console_log from pycket.env import w_version import os if generate_zo: try: os.remove("expander.zo") except OSError: pass if set_version and os.path.exists("expander.zo"): console_log("Loading the expander linklet from expander.zo") # We're loading the expander, so try fasl->sexp from pycket.racket_entry import get_primitive from pycket.prims.input_output import open_input_file with PerfRegion("expander-linklet"): fasl_to_s_exp = get_primitive("fasl->s-exp") in_file = open_input_file.w_prim.call_interpret( [W_Path("expander.zo")]) try: expander_zo_sexp = fasl_to_s_exp.call_interpret( [in_file, w_true]) version = expander_zo_sexp.car() expander_sexp = expander_zo_sexp.cdr() expander_linkl = deserialize_loop(expander_sexp) w_version.set_version(version.tostring()) console_log("Setting the version to %s" % version.tostring()) return expander_linkl, None except (SchemeException, OSError): console_log("Couldn't read from expander.zo") """ Expands and loads a linklet from a JSON file""" with PerfRegion("json-load"): data = readfile_rpython(json_file_name) json = pycket_json.loads(data) console_log("Finished reading JSON from %s" % json_file_name, 2) assert json.is_object json_python_dict = json.value_object() assert "linklet" in json_python_dict linklet_dict = getkey(json_python_dict, "linklet", type='o') assert "exports" in linklet_dict and "body" in linklet_dict # list of JsonObject exports_list = getkey(linklet_dict, "exports", type='a') if set_version: from pycket.util import console_log conf = getkey(linklet_dict, "config", type='o') ver = conf['version'].value_string() console_log("Setting the version to %s" % ver) w_version.set_version(ver) exports = {} for exp in exports_list: if exp.is_array: arr = exp.value_array() internal_str = arr[0].value_object()['quote'].value_object( )['toplevel'].value_string() internal_name = W_Symbol.make(internal_str) external_name = W_Symbol.make( arr[1].value_object()['quote'].value_object() ['toplevel'].value_string()) w_internal_name = Gensym.gensym(internal_str) exports[internal_name] = Export(w_internal_name, external_name) else: exp_str = exp.value_object()['quote'].value_object( )['toplevel'].value_string() exp_sym = W_Symbol.make(exp_str) w_exp_sym = Gensym.gensym(exp_str) exports[exp_sym] = Export(w_exp_sym, exp_sym) imports_list = getkey(linklet_dict, "importss", type='a', default=[]) importss = [None] * len(imports_list) # list of dict if "importss" in linklet_dict: for index, imports in enumerate(imports_list): arr = imports.value_array() # bootstrap linklets have no imports at all # this is only for debugging purposes instance_imports = [] for id_str in arr: imp_str = id_str.value_object()['quote'].value_object( )['toplevel'].value_string() imp_sym = W_Symbol.make(imp_str) w_imp_sym = Gensym.gensym(imp_str) instance_imports.append( Import(W_Fixnum(index), imp_sym, w_imp_sym, w_imp_sym)) importss[index] = instance_imports console_log("Converting linklet forms to AST ...", 2) loader = JsonLoader() with PerfRegion("json-to-ast"): all_forms = [] for body_form in getkey(linklet_dict, "body", type='a'): form_2 = loader.to_ast(body_form) form_1 = Context.normalize_term(form_2) # if form_1.tostring() != form_2.tostring(): # import pdb;pdb.set_trace() form = assign_convert(form_1) all_forms.append(form) # for each exported defined id, we need to add a # variable-set! for the exported var with the defined id for exp_sym, exp_obj in exports.iteritems(): rator = ModuleVar(var_set_sym, "#%kernel", var_set_sym, None) exp_var = LinkletStaticVar(exp_obj.int_id) top_var = ToplevelVar(exp_sym) mode = Quote(values.w_false) # FIXME: possible optimization rands = [exp_var, top_var, mode] all_forms.append(App.make(rator, rands)) linkl = W_Linklet(W_Symbol.make(json_file_name), importss, exports, all_forms) console_log("Finished converting linklet forms to AST ...", 2) config = {} config_obj = getkey(linklet_dict, "config", type='o') if config_obj is not None: for k, v in config_obj.iteritems(): config[k] = v.value_string() if set_version and not os.path.exists("expander.zo"): console_log("Serializing the expander linklet into expander.zo") from pycket.racket_entry import get_primitive from pycket.prims.input_output import open_output_file s_exp_to_fasl = get_primitive("s-exp->fasl") expander_sexp = ast_to_sexp(linkl) version = W_Symbol.make(w_version.get_version()) expander_zo_sexp = W_Cons.make(version, expander_sexp) try: out_file = open_output_file.w_prim.call_interpret( [W_Path("expander.zo")]) s_exp_to_fasl.call_interpret( [expander_zo_sexp, out_file, values.w_false]) except (SchemeException, OSError): console_log("Couldn't write the expander.zo") return linkl, config