Example #1
0
def main(*args):
    """main()
    Main routine for the MyFront compiler."""
    env = mybuiltins.initial_environment()
    for arg in args:
        arg_path = os.path.abspath(os.path.split(arg)[0])
        sys.path.append(arg_path)
        env = toplevel_compile_to_file(arg, env)
        sys.path.remove(arg_path)
Example #2
0
 def _wrapped_pass(arg, env=None):
     if env is None:
         env = mybuiltins.initial_environment()
     try:
         compiler_pass_fn = compiler_pass
         if isinstance(compiler_pass_fn, str):
             if compiler_pass_fn in env:
                 compiler_pass_fn = env[compiler_pass_fn]
             else:
                 raise KeyError("%r not in compile-time environment" % (compiler_pass_fn,))
         ret_val = compiler_pass_fn(arg, env)
     except MyFrontException, myfront_exc:
         handle_toplevel_error(myfront_exc)