If you look at the F# 2.0 compiler (see Adam's link), you will find in its source a file named IncrementalBuilding.fs. This is how Visual Studio does its own incremental building (which is why it can give you errors as you type, without compiling all the project on every key press).

I never got around to reading this file, but I think it is going to help you.

By on 10/22/2011 11:00 AM ()

Thank you for your answers and your help.

For now, I'm still searching solutions and experimenting. :)

Chris

Edit: removed useless details.

By on 10/22/2011 5:03 PM ()

AFAIK, the recent F# 3.0 RC (with type providers) is not yet available in source, but the earlier compiler is, as part of the F# PowerPack, so you should look there for a start. The AST is not documented, but pretty easy to follow and you can relatively easily decypher the hook-in point after the parsing phase.

At this point, you have at least two choices:

  • Deal with the extra configuration that the command-line compiler requires (default compiler options, assembly references, etc.) - this is the most robust path if you are compiling larger pieces of code that is based on F# constructs.
  • You might find that it is too complex for what you need: you can try a simpler, totally different approach: Reflection.Emit instead - this provides a relatively easy-to-use API to produce CIL on the fly.

Can you share more about what you are compiling, perhaps I can give a slightly more useful answer. Cheers.

By on 10/21/2011 10:43 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper