From 21f265d30a5fe1d4b2bcc2c53d931a42799fe93f Mon Sep 17 00:00:00 2001 From: Sarah Marshall Date: Mon, 27 Apr 2020 16:37:41 -0700 Subject: [PATCH 01/98] Create new project for entry point driver --- Simulation.sln | 19 +++ src/Simulation/CsharpGeneration/EntryPoint.fs | 99 ++++++++------ .../Microsoft.Quantum.CsharpGeneration.fsproj | 10 +- .../CsharpGeneration/RewriteStep.fs | 5 +- .../EntryPoint => EntryPointDriver}/Driver.cs | 127 ++++++++++-------- .../EntryPointDriver/EntryPointDriver.csproj | 15 +++ .../EntryPointDriver/IEntryPoint.cs | 21 +++ .../Parsers.cs | 16 +-- .../Validation.cs | 10 +- 9 files changed, 205 insertions(+), 117 deletions(-) rename src/Simulation/{CsharpGeneration/Resources/EntryPoint => EntryPointDriver}/Driver.cs (64%) create mode 100644 src/Simulation/EntryPointDriver/EntryPointDriver.csproj create mode 100644 src/Simulation/EntryPointDriver/IEntryPoint.cs rename src/Simulation/{CsharpGeneration/Resources/EntryPoint => EntryPointDriver}/Parsers.cs (96%) rename src/Simulation/{CsharpGeneration/Resources/EntryPoint => EntryPointDriver}/Validation.cs (96%) diff --git a/Simulation.sln b/Simulation.sln index c5a58260186..ca07a7fe45b 100644 --- a/Simulation.sln +++ b/Simulation.sln @@ -39,6 +39,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "TestProjects", "TestProject EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "QsharpExe", "src\Simulation\Simulators.Tests\TestProjects\QsharpExe\QsharpExe.csproj", "{2F5796A7-4AF8-4B78-928A-0A3A80752F9D}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EntryPointDriver", "src\Simulation\EntryPointDriver\EntryPointDriver.csproj", "{944FE7EF-9220-4CC6-BB20-CE517195B922}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -259,6 +261,22 @@ Global {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU {2F5796A7-4AF8-4B78-928A-0A3A80752F9D}.RelWithDebInfo|x64.Build.0 = Release|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|Any CPU.Build.0 = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|x64.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Debug|x64.Build.0 = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|Any CPU.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|Any CPU.Build.0 = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|x64.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.MinSizeRel|x64.Build.0 = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|Any CPU.ActiveCfg = Release|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|Any CPU.Build.0 = Release|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|x64.ActiveCfg = Release|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.Release|x64.Build.0 = Release|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|Any CPU.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|Any CPU.Build.0 = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|x64.ActiveCfg = Debug|Any CPU + {944FE7EF-9220-4CC6-BB20-CE517195B922}.RelWithDebInfo|x64.Build.0 = Debug|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -278,6 +296,7 @@ Global {B96E97F4-2DC8-45AC-ADF5-861D0D3073FC} = {A567C185-A429-418B-AFDE-6F1785BA4A77} {09C842CB-930C-4C7D-AD5F-E30DE4A55820} = {34D419E9-CCF1-4E48-9FA4-3AD4B86BEEB4} {2F5796A7-4AF8-4B78-928A-0A3A80752F9D} = {09C842CB-930C-4C7D-AD5F-E30DE4A55820} + {944FE7EF-9220-4CC6-BB20-CE517195B922} = {A567C185-A429-418B-AFDE-6F1785BA4A77} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {929C0464-86D8-4F70-8835-0A5EAF930821} diff --git a/src/Simulation/CsharpGeneration/EntryPoint.fs b/src/Simulation/CsharpGeneration/EntryPoint.fs index 7a2148ea449..86e907e6e7a 100644 --- a/src/Simulation/CsharpGeneration/EntryPoint.fs +++ b/src/Simulation/CsharpGeneration/EntryPoint.fs @@ -25,22 +25,21 @@ type private Parameter = /// The namespace in which to put generated code for the entry point. let generatedNamespace entryPointNamespace = entryPointNamespace + ".__QsEntryPoint__" -/// A public constant field. -let private constant name typeName value = - ``field`` typeName name [``public``; ``const``] (``:=`` value |> Some) - -/// A public static property with a getter. -let private readonlyProperty name typeName value = - ``property-arrow_get`` typeName name [``public``; ``static``] - ``get`` (``=>`` value) +/// The namespace containing the non-generated parts of the entry point driver. +let private nonGeneratedNamespace = "Microsoft.Quantum.QsCompiler.CsharpGeneration.EntryPointDriver" /// A static class containing constants used by the entry point driver. let private constantsClass = + let property name typeName value = + ``property-arrow_get`` typeName name [``public``; ``static``] ``get`` (``=>`` value) + let constant name typeName value = + ``field`` typeName name [``public``; ``const``] (``:=`` value |> Some) + ``class`` "Constants" ``<<`` [] ``>>`` ``:`` None ``,`` [] [``internal``; ``static``] ``{`` - [readonlyProperty "SimulatorOptions" "System.Collections.Generic.IEnumerable" + [property "SimulatorOptions" "System.Collections.Generic.IEnumerable" (``new array`` (Some "") [``literal`` ("--" + fst CommandLineArguments.SimulatorOption) ``literal`` ("-" + snd CommandLineArguments.SimulatorOption)]) constant "QuantumSimulator" "string" (``literal`` AssemblyConstants.QuantumSimulator) @@ -80,8 +79,10 @@ let private argumentParser qsType = match qsType with | ArrayType _ -> "ParseArgumentsWith" | _ -> "ParseArgumentWith" - valueParser qsType |> Option.map (fun valueParser -> - ``ident`` "Parsers" <.> (``ident`` argParser, [``ident`` "Parsers" <|.|> ``ident`` valueParser])) + let parsersIdent = ``ident`` (nonGeneratedNamespace + ".Parsers") + valueParser qsType + |> Option.map (fun valueParser -> + parsersIdent <.> (``ident`` argParser, [parsersIdent <|.|> ``ident`` valueParser])) /// Adds suggestions, if any, to the option based on the Q# type. let private withSuggestions qsType option = @@ -117,9 +118,22 @@ let private parameterOptionsProperty parameters = |> withSuggestions qsType.Resolution let options = parameters |> Seq.map getOption |> Seq.toList - ``property-arrow_get`` optionsEnumerableTypeName "Options" [``public``; ``static``] + ``property-arrow_get`` optionsEnumerableTypeName "Options" [``public``] ``get`` (``=>`` (``new array`` (Some optionTypeName) options)) +/// A method that creates an instance of the default simulator if it is a custom simulator. +let private customSimulatorFactory name = + let expr : ExpressionSyntax = + if name = AssemblyConstants.QuantumSimulator || + name = AssemblyConstants.ToffoliSimulator || + name = AssemblyConstants.ResourcesEstimator + then upcast SyntaxFactory.ThrowExpression (``new`` (``type`` "InvalidOperationException") ``(`` [] ``)``) + else ``new`` (``type`` name) ``(`` [] ``)`` + ``arrow_method`` "IOperationFactory" "CreateDefaultCustomSimulator" ``<<`` [] ``>>`` + ``(`` [] ``)`` + [``public``] + (Some (``=>`` expr)) + /// The name of the parameter property for the given parameter name. let private parameterPropertyName (s : string) = s.Substring(0, 1).ToUpper() + s.Substring 1 @@ -131,8 +145,10 @@ let private parameterProperties = /// The method for running the entry point using the parameter properties declared in the adapter. let private runMethod context (entryPoint : QsCallable) = let entryPointName = sprintf "%s.%s" entryPoint.FullName.Namespace.Value entryPoint.FullName.Name.Value - let returnTypeName = SimulationCode.roslynTypeName context entryPoint.Signature.ReturnType - let taskTypeName = sprintf "System.Threading.Tasks.Task<%s>" returnTypeName + // TODO: + // let returnTypeName = SimulationCode.roslynTypeName context entryPoint.Signature.ReturnType + // let taskTypeName = sprintf "System.Threading.Tasks.Task<%s>" returnTypeName + let taskTypeName = "System.Threading.Tasks.Task" let factoryParamName = "__factory__" let argExpr { Name = name; QsharpType = qsType } = @@ -143,7 +159,7 @@ let private runMethod context (entryPoint : QsCallable) = ``new`` (``type`` arrayTypeName) ``(`` [property] ``)`` | _ -> property - let callArgs : seq = + let callArgs : ExpressionSyntax seq = Seq.concat [ Seq.singleton (upcast ``ident`` factoryParamName) Seq.map argExpr (parameters context entryPoint.Documentation entryPoint.ArgumentTuple) @@ -154,31 +170,30 @@ let private runMethod context (entryPoint : QsCallable) = [``public``; ``async``] (Some (``=>`` (``await`` (``ident`` entryPointName <.> (``ident`` "Run", callArgs))))) -/// A method that creates an instance of the default simulator if it is a custom simulator. -let private customSimulatorFactory name = - let expr : ExpressionSyntax = - if name = AssemblyConstants.QuantumSimulator || - name = AssemblyConstants.ToffoliSimulator || - name = AssemblyConstants.ResourcesEstimator - then upcast SyntaxFactory.ThrowExpression (``new`` (``type`` "InvalidOperationException") ``(`` [] ``)``) - else ``new`` (``type`` name) ``(`` [] ``)`` - ``arrow_method`` "IOperationFactory" "CreateDefaultCustomSimulator" ``<<`` [] ``>>`` - ``(`` [] ``)`` - [``public``; ``static``] - (Some (``=>`` expr)) +/// The main method for the standalone executable. +let private mainMethod = + let commandLineArgsName = "args" + let runIdent = ``ident`` (nonGeneratedNamespace + ".Driver.Run") + let runArgs = [``new`` (``type`` "EntryPoint") ``(`` [] ``)``; upcast ``ident`` commandLineArgsName] + ``arrow_method`` "System.Threading.Tasks.Task" "Main" ``<<`` [] ``>>`` + ``(`` [``param`` commandLineArgsName ``of`` (``type`` "string[]")] ``)`` + [``private``; ``static``; ``async``] + (Some (``=>`` (``await`` (``invoke`` runIdent ``(`` runArgs ``)``)))) /// The class that adapts the entry point for use with the command-line parsing library and the driver. let private adapterClass context (entryPoint : QsCallable) = + let property name typeName value = + ``property-arrow_get`` typeName name [``public``] ``get`` (``=>`` value) + let summaryProperty = - readonlyProperty "Summary" "string" (``literal`` ((PrintSummary entryPoint.Documentation false).Trim ())) + property "Summary" "string" (``literal`` ((PrintSummary entryPoint.Documentation false).Trim ())) let defaultSimulator = context.assemblyConstants.TryGetValue AssemblyConstants.DefaultSimulator |> snd |> (fun value -> if String.IsNullOrWhiteSpace value then AssemblyConstants.QuantumSimulator else value) - let defaultSimulatorProperty = readonlyProperty "DefaultSimulator" "string" (``literal`` defaultSimulator) + let defaultSimulatorProperty = property "DefaultSimulator" "string" (``literal`` defaultSimulator) let parameters = parameters context entryPoint.Documentation entryPoint.ArgumentTuple - - let members : seq = + let members : MemberDeclarationSyntax seq = Seq.concat [ Seq.ofList [ summaryProperty @@ -186,12 +201,14 @@ let private adapterClass context (entryPoint : QsCallable) = parameterOptionsProperty parameters customSimulatorFactory defaultSimulator runMethod context entryPoint + mainMethod ] parameterProperties parameters |> Seq.map (fun property -> upcast property) ] + let baseName = simpleBase (nonGeneratedNamespace + ".IEntryPoint") ``class`` "EntryPoint" ``<<`` [] ``>>`` - ``:`` None ``,`` [] + ``:`` (Some baseName) ``,`` [] [``internal``] ``{`` members @@ -211,17 +228,21 @@ let private generatedClasses context (entryPoint : QsCallable) = ``compilation unit`` [] [] [ns] |> ``with leading comments`` SimulationCode.autogenComment |> SimulationCode.formatSyntaxTree - |> fun code -> code + Environment.NewLine /// The source code for the entry point driver. -let private driver (entryPoint : QsCallable) = +let private driver () = let source fileName = - let resourceName = "Microsoft.Quantum.CsharpGeneration.Resources.EntryPoint." + fileName + let resourceName = "Microsoft.Quantum.CsharpGeneration." + fileName use stream = Assembly.GetExecutingAssembly().GetManifestResourceStream resourceName use reader = new StreamReader(stream) - reader.ReadToEnd().Replace("@Namespace", generatedNamespace entryPoint.FullName.Namespace.Value) - String.Join (Environment.NewLine, source "Driver.cs", source "Parsers.cs", source "Validation.cs") + reader.ReadToEnd () + [ + "Driver.cs" + "IEntryPoint.cs" + "Parsers.cs" + "Validation.cs" + ] + |> List.map (fun fileName -> Path.GetFileNameWithoutExtension fileName, source fileName) /// Generates C# source code for a standalone executable that runs the Q# entry point. -let generate context entryPoint = - generatedClasses context entryPoint + driver entryPoint +let generate context entryPoint = ("EntryPoint", generatedClasses context entryPoint) :: driver () diff --git a/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj b/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj index 0a279b90245..819ba978a64 100644 --- a/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj +++ b/src/Simulation/CsharpGeneration/Microsoft.Quantum.CsharpGeneration.fsproj @@ -8,9 +8,12 @@ - - - + + + + + + @@ -30,5 +33,4 @@ - diff --git a/src/Simulation/CsharpGeneration/RewriteStep.fs b/src/Simulation/CsharpGeneration/RewriteStep.fs index 8384bcbc107..ee9d7eeac9f 100644 --- a/src/Simulation/CsharpGeneration/RewriteStep.fs +++ b/src/Simulation/CsharpGeneration/RewriteStep.fs @@ -68,8 +68,9 @@ type Emitter() = if not compilation.EntryPoints.IsEmpty then let callable = context.allCallables.[Seq.exactlyOne compilation.EntryPoints] - let content = EntryPoint.generate context callable - CompilationLoader.GeneratedFile(callable.SourceFile, dir, ".EntryPoint.g.cs", content) |> ignore + for name, content in EntryPoint.generate context callable do + let suffix = sprintf ".%s.g.cs" name + CompilationLoader.GeneratedFile(callable.SourceFile, dir, suffix, content) |> ignore transformed <- compilation true diff --git a/src/Simulation/CsharpGeneration/Resources/EntryPoint/Driver.cs b/src/Simulation/EntryPointDriver/Driver.cs similarity index 64% rename from src/Simulation/CsharpGeneration/Resources/EntryPoint/Driver.cs rename to src/Simulation/EntryPointDriver/Driver.cs index d461e0f133e..4f3726dee5a 100644 --- a/src/Simulation/CsharpGeneration/Resources/EntryPoint/Driver.cs +++ b/src/Simulation/EntryPointDriver/Driver.cs @@ -1,26 +1,33 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -namespace @Namespace -{ - using Microsoft.Quantum.Simulation.Core; - using Microsoft.Quantum.Simulation.Simulators; - using System; - using System.Collections.Generic; - using System.Collections.Immutable; - using System.CommandLine; - using System.CommandLine.Builder; - using System.CommandLine.Help; - using System.CommandLine.Invocation; - using System.CommandLine.Parsing; - using System.Linq; - using System.Threading.Tasks; +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.CommandLine; +using System.CommandLine.Builder; +using System.CommandLine.Help; +using System.CommandLine.Invocation; +using System.CommandLine.Parsing; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Quantum.QsCompiler.ReservedKeywords; +using Microsoft.Quantum.Simulation.Core; +using Microsoft.Quantum.Simulation.Simulators; +namespace Microsoft.Quantum.QsCompiler.CsharpGeneration.EntryPointDriver +{ /// /// The entry point driver is the entry point for the C# application that executes the Q# entry point. /// internal static class Driver { + private static readonly IEnumerable SimulatorOptions = new[] + { + CommandLineArguments.SimulatorOption.Item1, + CommandLineArguments.SimulatorOption.Item2 + }; + /// /// A modification of the command line class. /// @@ -37,29 +44,30 @@ protected override string ArgumentDescriptor(IArgument argument) } /// - /// Runs the entry point. + /// Runs the entry point using the command-line arguments. /// /// The command-line arguments. /// The exit code. - private static async Task Main(string[] args) + internal static async Task Run(IEntryPoint entryPoint, string[] args) { var simulate = new Command("simulate", "(default) Run the program using a local simulator."); TryCreateOption( - Constants.SimulatorOptions, - () => EntryPoint.DefaultSimulator, + entryPoint, + SimulatorOptions, + () => entryPoint.DefaultSimulator, "The name of the simulator to use.").Then(option => { option.Argument.AddSuggestions(ImmutableHashSet.Empty - .Add(Constants.QuantumSimulator) - .Add(Constants.ToffoliSimulator) - .Add(Constants.ResourcesEstimator) - .Add(EntryPoint.DefaultSimulator)); + .Add(AssemblyConstants.QuantumSimulator) + .Add(AssemblyConstants.ToffoliSimulator) + .Add(AssemblyConstants.ResourcesEstimator) + .Add(entryPoint.DefaultSimulator)); simulate.AddOption(option); }); - simulate.Handler = CommandHandler.Create(Simulate); + simulate.Handler = CommandHandler.Create((string simulator) => Simulate(entryPoint, simulator)); - var root = new RootCommand(EntryPoint.Summary) { simulate }; - foreach (var option in EntryPoint.Options) { root.AddGlobalOption(option); } + var root = new RootCommand(entryPoint.Summary) { simulate }; + foreach (var option in entryPoint.Options) { root.AddGlobalOption(option); } // Set the simulate command as the default. foreach (var option in simulate.Options) { root.AddOption(option); } @@ -78,32 +86,29 @@ private static async Task Main(string[] args) /// The entry point. /// The simulator to use. /// The exit code. - private static async Task Simulate(EntryPoint entryPoint, string simulator) + private static async Task Simulate(IEntryPoint entryPoint, string simulator) { - simulator = DefaultIfShadowed(Constants.SimulatorOptions.First(), simulator, EntryPoint.DefaultSimulator); - switch (simulator) + simulator = DefaultIfShadowed(entryPoint, SimulatorOptions.First(), simulator, entryPoint.DefaultSimulator); + if (simulator == AssemblyConstants.ResourcesEstimator) + { + var resourcesEstimator = new ResourcesEstimator(); + await entryPoint.Run(resourcesEstimator); + Console.WriteLine(resourcesEstimator.ToTSV()); + } + else { - case Constants.ResourcesEstimator: - var resourcesEstimator = new ResourcesEstimator(); - await entryPoint.Run(resourcesEstimator); - Console.WriteLine(resourcesEstimator.ToTSV()); - break; - default: - var (isCustom, createSimulator) = simulator switch - { - Constants.QuantumSimulator => - (false, new Func(() => new QuantumSimulator())), - Constants.ToffoliSimulator => - (false, new Func(() => new ToffoliSimulator())), - _ => (true, EntryPoint.CreateDefaultCustomSimulator) - }; - if (isCustom && simulator != EntryPoint.DefaultSimulator) - { - DisplayCustomSimulatorError(simulator); - return 1; - } - await DisplayEntryPointResult(entryPoint, createSimulator); - break; + var (isCustom, createSimulator) = + simulator == AssemblyConstants.QuantumSimulator + ? (false, () => new QuantumSimulator()) + : simulator == AssemblyConstants.ToffoliSimulator + ? (false, new Func(() => new ToffoliSimulator())) + : (true, entryPoint.CreateDefaultCustomSimulator); + if (isCustom && simulator != entryPoint.DefaultSimulator) + { + DisplayCustomSimulatorError(simulator); + return 1; + } + await DisplayEntryPointResult(entryPoint, createSimulator); } return 0; } @@ -114,15 +119,13 @@ private static async Task Simulate(EntryPoint entryPoint, string simulator) /// The entry point. /// A function that creates an instance of the simulator to use. private static async Task DisplayEntryPointResult( - EntryPoint entryPoint, Func createSimulator) + IEntryPoint entryPoint, Func createSimulator) { var simulator = createSimulator(); try { var value = await entryPoint.Run(simulator); -#pragma warning disable CS0184 if (!(value is QVoid)) -#pragma warning restore CS0184 { Console.WriteLine(value); } @@ -142,8 +145,8 @@ private static async Task DisplayEntryPointResult( /// /// The alias to check. /// True if the alias is available for use by the driver. - private static bool IsAliasAvailable(string alias) => - !EntryPoint.Options.SelectMany(option => option.RawAliases).Contains(alias); + private static bool IsAliasAvailable(IEntryPoint entryPoint, string alias) => + !entryPoint.Options.SelectMany(option => option.RawAliases).Contains(alias); /// /// Returns the default value and displays a warning if the alias is shadowed by an entry point option, and @@ -154,9 +157,9 @@ private static bool IsAliasAvailable(string alias) => /// The value of the option given on the command line. /// The default value for the option. /// - private static T DefaultIfShadowed(string alias, T value, T defaultValue) + private static T DefaultIfShadowed(IEntryPoint entryPoint, string alias, T value, T defaultValue) { - if (IsAliasAvailable(alias)) + if (IsAliasAvailable(entryPoint, alias)) { return value; } @@ -181,10 +184,16 @@ private static T DefaultIfShadowed(string alias, T value, T defaultValue) /// The option's description. /// A validation of the option. private static Validation> TryCreateOption( - IEnumerable aliases, Func getDefaultValue, string description = null) => - IsAliasAvailable(aliases.First()) + IEntryPoint entryPoint, + IEnumerable aliases, + Func getDefaultValue, + string description = null) => + IsAliasAvailable(entryPoint, aliases.First()) ? Validation>.Success( - new Option(aliases.Where(IsAliasAvailable).ToArray(), getDefaultValue, description)) + new Option( + aliases.Where(alias => IsAliasAvailable(entryPoint, alias)).ToArray(), + getDefaultValue, + description)) : Validation>.Failure(); /// diff --git a/src/Simulation/EntryPointDriver/EntryPointDriver.csproj b/src/Simulation/EntryPointDriver/EntryPointDriver.csproj new file mode 100644 index 00000000000..655b1208aa3 --- /dev/null +++ b/src/Simulation/EntryPointDriver/EntryPointDriver.csproj @@ -0,0 +1,15 @@ + + + netstandard2.1 + + + + + + + + + + + + diff --git a/src/Simulation/EntryPointDriver/IEntryPoint.cs b/src/Simulation/EntryPointDriver/IEntryPoint.cs new file mode 100644 index 00000000000..c3ee7d98d81 --- /dev/null +++ b/src/Simulation/EntryPointDriver/IEntryPoint.cs @@ -0,0 +1,21 @@ +using System.Collections.Generic; +using System.CommandLine; +using System.Threading.Tasks; +using Microsoft.Quantum.Simulation.Core; + +namespace Microsoft.Quantum.QsCompiler.CsharpGeneration.EntryPointDriver +{ + internal interface IEntryPoint + { + string Summary { get; } + + IEnumerable