private static Int32 Main() { if (_args.Contains("debug")) { Debugger.Launch(); } if (_args.Contains("help")) { Console.WriteLine("Usage: {0} [switches] [--] [inputs]", Path.GetFileNameWithoutExtension(Environment.GetCommandLineArgs()[0])); Console.WriteLine( String.Join(Environment.NewLine, _options .SelectMany(o => new [] { " " + String.Join(", ", o.ShortNames .Select(n => "-" + n) .Concat(o.LongNames.Select(n => "--" + n)) ), " " + o.Description, } )) ); return(0); } if (_args.Contains("version")) { Console.WriteLine( #region String @"YACQ <http://yacq.net/> Yet Another Compilable Query Language, based on Expression Trees API Language service is provided by Yacq.dll, the assembly name is: {0} YACQ Runner (YACQRun) is part of YACQ Runner and Compiler of YACQ Copyright © 2011-2013 Takeshi KIRIYA (aka takeshik) <*****@*****.**> All rights reserved. YACQ and YACQ Runner are Free Software; licensed under the MIT License." #endregion , typeof(YacqServices).Assembly.FullName ); return(0); } var input = Read(); if (_args.Contains("compile")) { Compile( input, _args["_param"] .FirstOrDefault(p => p != "-") .Null(p => Path.GetFileNameWithoutExtension(p)) ?? "a.out", _args.Contains("winexe") ? PEFileKinds.WindowApplication : _args.Contains("library") ? PEFileKinds.Dll : PEFileKinds.ConsoleApplication ); } else { var ret = 0; var expression = Parse(null, input); if (!_args.Contains("parse")) { try { Expression.Lambda(expression) .Evaluate() .If(o => o is Int32, o => ret = (Int32)o); } catch (Exception ex) { Fail(ex, Phase.Evaluate); } } if (_args.Contains("dump-tree")) { Console.Error.WriteLine(YacqServices.SaveText(expression)); } return(ret); } return(0); }