diff --git a/ucompile b/ucompile index 9e1fc61..7140d98 100755 --- a/ucompile +++ b/ucompile @@ -154,7 +154,12 @@ def c_compile(file_name, args): def main(): - SUPPORTED_LANGS = [".c", ".py", ".java", ".hs"] + SUPPORTED_LANGS = { + ".c": c_compile, + ".py": python_compile, + ".java": java_compile, + ".hs": haskell_compile, + } parser = argparse.ArgumentParser( prog="UCompiler", description="Compiles based on language", epilog="LOL" ) @@ -200,16 +205,8 @@ def main(): args.tests_dir = args.tests if args.tests else "." - if file_ext == ".c": - c_compile(file_name, args) - elif file_ext == ".py": - python_compile(file_name, args) - elif file_ext == ".java": - java_compile(file_name, args) - elif file_ext == ".hs": - haskell_compile(file_name, args) + SUPPORTED_LANGS[file_ext](file_name, args) - print(args) return