3 ms·
>I also imagine the F# compiler's source code to be drastically smaller and simpler given both its history and the ease of writing compilers in F#. I agree tha
by Arnavion 7y ago
>I also imagine the F# compiler's source code to be drastically smaller and simpler given both its history and the ease of writing compilers in F#.
I agree that the F# compiler's codebase is much smaller than C# (wc suggests 417k lines for dotnet/roslyn:src/Compilers/CSharp/ vs 190k lines for dotnet/fsharp:src/, which is hopefully all the right files).
But as far as simpler goes, the compiler is quite a bit complicated by having to implement F# in terms of .Net. Enum variants are actually classes inheriting from the class representing the enum, modules are actually classes, core library members being called by different names in F# vs not, the desugaring of computation expressions into state machines, ...
Then there's F#-specific stuff, like the core library, having two different kinds of parsers (#light on and off), two different kinds of generics, quotations, ...