Hi Michael,
As a starting point, see the use of this type in the SimpleSourceCodeServices API in
src\fsharp\FSharp.Compiler.Silverlight\fsisilverlight.fs
and the two samples that are built on that in
samples\SilverlightHostedCompilerServices
That SimpleSourceCodeServices API is only included in the Silverlight-hosted compiler (though there is no real reason why it should not be included in the .NET 4.0 version of FSharp.Compiler.dll, though some adjustments would be needed).
It allows for
- tokenization
- brace-matching
- type-checking
- compilation-to-static-assembly
- compilation-to-dynamic-assembly-without-execution-of-top-level-bindings
- compilation-to-dynamic-assembly-with-execution-of-top-level-bindings-and-capturing-stdin-stdout-stderr
of a single script file. This is generally done without "project context" (additional project options or DLL references) and is done synchronously (though can be invoked from a background compilation thread or compilation agent)
The options are usually given like this:
let options = { ProjectFileName="console.fsproj";
ProjectFileNames=[| "example.fsx" |];
ProjectOptions=[| |];
IsIncompleteTypeCheckEnvironment=false;
UseScriptResolutionRules=true }
In some of cases, like compilation, "project options" can be given to indicate a set of additional command line options. These allow, for example, to reference a different mscorlib.dll and FSharp.Core.dll. Despite the comments in fsisilverlight.fs, this means the API can be used to compile scripts to .NET and other kinds of binaries.
The SimpleSourceCodeServices API is not as yet suitable for compiling projects. The F# MonoDevelop source code gives a guide to how the underlying compiler functionality can be used for more complex cases like that.
I'll aim to add some additional documentation to these types and methods.
Thanks
Don
--
You received this message because you are subscribed to the Google
Groups "FSharp Open Source Community" group.
To post to this group, send email to
fsharp-o...@googlegroups.com
To unsubscribe from this group, send email to
fsharp-opensou...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/fsharp-opensource?hl=en