A high level language with transparency at its core.
This repository is contains the Flint Interop Protocol implementation.
Documentation · Report a Bug · Request Feature · Send a Pull Request
The Flint Interop Protocol (FIP) is a protocol aimed at generalizing the communication of multiple compile modules for the Flint compiler. The Flint compiler handles all extern functions as black boxes. The FIP works like this:
- The Flint Compiler (
flintc) will spawn all enabledfipmodules from the config located in.fip/config/fip.toml - The Compiler waits for all spawned Interop Modules to send a connect request to it
- The FIP version information is checked, modules with non-matching versions are rejected
- After the IMs connected to the compiler they will go through their source files and search for all symbols they can provide
- The Flint Compiler (
flintc) will come across an external function definition likeextern def foo(i32 x);and it will broadcast a symbol resulution request to all active IMs - All IMs go through their symbols and check whether they provide the given symbol and send a message back to the compiler whether they provide the given symbol
- This repeats for the whole parsing process and all external functions the compiler may come across
- After parsing, the Flint Compiler (
flintc) will send a compile request to all connected IMs. If the IMs provide symbols the compiler requested earlier, they will now compile their respective sources needed for the requested symbols into hashed files like.fip/cache/AJKsdf2p.oin the cache directory. - During the compilation of all IMs the Flint Compiler generates the Flint code and produces the
main.ofile used for linking - Before linking, the Flint Compiler sends a object request to all IMs and they return a list of 8-Byte hashes describing their compiled files.
- The Flint Compiler then checks whether all extern code has compiled successfully, ensuring proper shutdown of the compiler when extern code is faulty
- During the linking stage the Flint Compiler will link all externally compiled
.ofiles to themain.ofile and link all together, producing a final executable - The Flint Compiler (
flintc) sends the kill message over the FIP to all the Interop Modules, telling them that they can shut down now.
The Flint compiler does not care into which language it calls, neither does it care where the .o files come from. This is the foundation of the FIP, because this way we can have a fip-c module responsible for parsing and checking C source files, being a "C expert" so to speak, and a different Interop Module, like fip-rs could be responsible for Rust. It is planned to provide a fip-ft Interop Module in the future too, to provide an interop module able to be used from other languages to call into Flint code.