static void DoCLI(string[] args) { bool compile = false; for (int i = 0; i < args.Length; i++) { string a = args[i]; if (!a.StartsWith("-")) { continue; } args[i] = null; switch (a) { case "-h": case "--help": Usage(); break; case "-c": case "--compile": compile = true; break; case "-e": case "--entry-point": if (++i >= args.Length) { Usage(); } string name = args[i]; if (!Names.HasNamespace(name)) { name = Names.Make("def", name); } Compiler.AddEntryPoint(name); args[i] = null; compile = true; break; case "-v": case "--verbose": Compiler.Verbose = true; break; case "-vv": case "--extra-verbose": Compiler.Verbose = true; Compiler.PrintFunctions = Console.Out; Compiler.PrintTrees = Console.Out; break; default: Usage(); break; } } Kernel.Init(); foreach (string arg in args) { if (arg == null) { continue; } using (TextReader r = File.OpenText(arg)) { Interpreter ip = new Interpreter(r); ip.Run(); } } if (compile) { Compiler.DoCompile(); } }