- MLIR libraries
- LLVM infrastructure
- F# Compiler Service
- PowerShell (for build scripting)
- MSYS2 or equivalent MinGW development environment
This project represents an experimental proof-of-concept for compiling F# directly to native executables using MLIR (Multi-Level Intermediate Representation) and LLVM, bypassing traditional .NET compilation infrastructure.
The MLIR and LLVM toolchain was acquired through the official MSYS2 Windows installer package, which provides a streamlined method for obtaining development tools and libraries for Windows.
Utilized the MSYS2 package manager (pacman) to install necessary development tools and libraries:
pacman -Syu # Update package database and core system packages
pacman -S mingw-w64-x86_64-toolchain
pacman -S mingw-w64-x86_64-llvm
pacman -S mingw-w64-x86_64-clang
pacman -S mingw-w64-x86_64-cmake
pacman -S mingw-w64-x86_64-ninja
src/
: Source code for the compiler pipelineBindings/
: Native bindings for MLIR and LLVMConversion/
: AST conversion logicPipeline/
: Compilation pipeline implementationExamples/
: Sample F# programs
tools/
: Build and development scriptsbuild/
: Compiled output directory
The compiler pipeline consists of several critical stages:
- F# Source Parsing
- Abstract Syntax Tree (AST) Conversion
- MLIR Dialect Generation
- LLVM IR Lowering
- Native Code Generation
Check path settings to match your project and dependency locations
The project uses a standalone F# Compiler Service instance, which is intentionally decoupled from the standard .NET ecosystem. This approach introduces several non-standard elements:
- The F# Compiler Service is compiled as a discrete library
- Build scripts use direct PowerShell orchestration to compile
- Type resolution and binding are hand-jammed in many cases
Warning: This implementation is inherently experimental and should be considered a research prototype.
Execute the compilation pipeline using the provided PowerShell script:
.\tools\build.ps1
- Compile F# MLIR Bindings
- Compile MLIR Wrapper Modules
- Generate Conversion Modules
- Build Compilation Pipeline
- Create Example Executables
Current limitations include:
- Minimal language feature support
- Experimental parsing mechanisms
- Limited optimization strategies
Potential future improvements:
- Enhanced type system mapping
- More comprehensive language construct support
- Advanced optimization passes
This is an MIT licensed open-source research project. Contributions, discussions, and explorations are welcome.
This compiler pipeline is a proof-of-concept. It is not intended for production use and represents an experimental approach to functional language compilation.