/// <summary>
        /// Compiles the specified input object.
        /// </summary>
        /// <param name="input">The compiler input information.</param>
        /// <returns>The compilation result.</returns>
        public CompilationResult Compile(CompilationRequest input)
        {
            if (input == null)
                throw new ArgumentNullException("input", "The compilation input cannot be null.");

            var pipeline = new CompilationPipeline();
            pipeline.AddProcess(new BuildVerificationProcess());
            pipeline.AddProcess(new SyntaxParsingProcess());
            pipeline.AddProcess(new SyntaxValidationProcess());
            pipeline.AddProcess(new PreprocessingProcess());
            pipeline.AddProcess(new TransformationProcess());
            pipeline.AddProcess(new ModelValidationProcess());
            pipeline.AddProcess(new TranslationProcess());

            using (var stream = File.Create(input.TargetPath + ".js"))
            {
                return pipeline.Execute(input, stream);
            }
        }
        /// <summary>
        /// Compiles from a project file.
        /// </summary>
        /// <param name="projectPath">The project path.</param>
        /// <param name="scriptPath">The script file path.</param>
        /// <returns>The compilation result.</returns>
        public CompilationResult CompileProject(string projectPath, string scriptPath = null)
        {
            // ensure project path is valid
            if (String.IsNullOrEmpty(projectPath) || !File.Exists(projectPath))
                return CompilationResult.FatalError("Unable to locate project file at " + projectPath);

            // load project and create compilation
            var project = Workspace.LoadStandAloneProject(projectPath)
                .CurrentSolution.Projects.Single();

            if (project == null)
                return CompilationResult.FatalError("Unable to open project file at " + projectPath);

            var compilation = project.GetCompilation();

            // workaround for project refs bug in Roslyn June 2012 CTP
            var fileRefs = compilation.References.OfType<AssemblyFileReference>();
            compilation = compilation.RemoveReferences(fileRefs)
                .AddReferences(fileRefs.Select(r => new AssemblyFileReference(r.Path)));

            var pipeline = new CompilationPipeline();
            // TODO: add diagnostics process
            //pipeline.AddProcess(new DiagnosticProcess());
            pipeline.AddProcess(new SyntaxValidationProcess());
            pipeline.AddProcess(new PreprocessingProcess());
            pipeline.AddProcess(new TransformationProcess());
            pipeline.AddProcess(new ModelValidationProcess());
            pipeline.AddProcess(new TranslationProcess());
            // TODO: add assembly emit process

            scriptPath = scriptPath ?? Path.ChangeExtension(projectPath, ".js");

            using (var stream = File.Create(scriptPath))
            {
                return pipeline.Compile(compilation, stream);
            }
        }