Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Will Roslyn be able to parse and compile F# code?

The Microsoft.CodeAnalysis.LanguageNames class has an entry for F#:

public static class LanguageNames
{
    public const string CSharp = "C#";
    public const string VisualBasic = "Visual Basic";
    public const string FSharp = "F#";
}

This got me excited, I thought I could let my users also use F# just by toggling one property. Alas, it doesn't seem to be the case. There are Roslyn nuget packages for C# and VB.NET but nothing for F#.

Is support for analyzing and running F# code planned in Roslyn?

If not, what alternatives would you recommend for parsing and executing F#?

like image 786
anakic Avatar asked Oct 15 '25 23:10

anakic


1 Answers

You can use F# Compiler Service.

The problem with F# on Roslyn is that F# has been self-hosted from the very start, while C# and VB compilers were written in C++ for a long time. By the time C# and VB finally grew up and got Roslyn, F# already had a well developed compiler with its own architecture. Worse, that architecture could not be easily followed in Roslyn (though I think they didn't even try), because it makes heavy use of language features not available in C# and VB.

like image 134
Fyodor Soikin Avatar answered Oct 18 '25 22:10

Fyodor Soikin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!