Created
February 1, 2013 08:40
-
-
Save PollRobots/4690135 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use compiler = new FSharpCodeProvider() | |
let parameters = CompilerParameters() | |
parameters.GenerateExecutable <- true | |
parameters.GenerateInMemory <- true | |
let result = compiler.CompileAssemblyFromSource(parameters, parser) | |
if result.Errors.Count > 0 then | |
for error in result.Errors do eprintfn "%O" error done | |
else | |
for output in result.Output do printfn "%O" output done | |
printfn "Executing..." | |
try | |
result.CompiledAssembly.EntryPoint.Invoke(null, null) |> ignore | |
with | |
| ex -> eprintfn "Error executing generated code: %s" ex.Message | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment