I've prepared compact .NET CIL interpreter called Fint in pure F# for NskDotNet Meetup #6.
It can run C# programs with the following features at this point:
- all control flow statements (if, for, switch, etc)
- arithmetic operations including bitwise one
- boolean algebra operators
- string concatenation
- static function calls
- Console.WriteLine calls
It can be easily extended with other features.
Some code in this project is just ported from PageFX project I wrote about recently.
It would be nice to try porting Fint to JavaScript using Fable and run .NET binary code right in a browser.
Later we can try to port Roslyn C# compiler to WASM with Blazor compiler and build online tutorial that:
- compiles small C# program to .NET PE file in browser
- runs .NET PE file in browser
- shows CIL code for given method
- provides debugging experience of CIL instruction set
This could be a great web resource to help learning .NET code at low-level.
If you like Fint repo please stargaze it on github.
Here is a recording of my presentation. Sorry for speaking so boring 😄
Enjoy! EOF 😄
Top comments (1)
I am thinking to port this to Rust. Then it can be easily compiled into WebAssembly and run in browser