Fyr is a modern systems programming language that combines the versatility of C with the ease and safety of application programming languages like Java, Go or TypeScript. Like C/C++, Fyr can be used for low-level hardware-oriented programming and high-level application programming. In contrast to C, the Fyr compiler guarantees memory safety and thread safety at compilation time.
As a systems programming language, Fyr targets all computing platforms. Currently the Fyr compiler generates code running in Web Browsers (as WebAssembly), desktops and servers (native or inside Node.JS), and simple IoT-devices like Arduino Uno or ESP32. It is planned to support GPUs and other non-standard hardware setups as well.
Fyr is a compiled language with static type checking, a lean memory footprint, and generates high-performance code. Fyr currently compiles to WebAssembly and C99 code. WebAssembly is supported by all modern browsers like Chrome, Firefox, Safari, Edge, and Node.JS. Thus, WebAssembly allows Fyr code to run on desktops, servers and mobile devices. Using C99 as output, Fyr code can even run efficiently on small embedded devices.
The motivation behind Fyr is that we are lacking a modern systems programming language that could replace C.
C has been created in 1972 and it is still in heavy use today for projects including operating systems, interpreters, GPU programming or embedded programming. Two properties contribute to the success of C. The language itself is not bound to a runtime system and it makes only few assumptions about the hardware it is running on. As a consequence, C code can run on almost any hardware, ranging from PCs, to GPUs and embedded. The drawback of C (and C++) is that the language is neither memory safe nor thread safe. Especially for modern IoT applications this increases the risk of bugs and security vulnerabilities.
Fyr is desgined as a safe replacement of C. However, replacing C entirely is a very long term goal. In the meantime, Fyr can be easily combined with existing C sources, because Fyr can compile to C code. If some hardware can run C then it can run Fyr as well.
Fyr has no garbage collector, because on restricted hardware there is not enough RAM to generate garbage in the first place. There might not even be a heap where dynamic data could be allocated. Fyr uses its type system and static code analysis to determine where memory is allocated and free’d (if there is a heap). In this respect it follows Rust and Swift, which have no garbage collector either. However, Fyr’s type system is less restrictive than that of Rust and closer to the hardware than that of Swift.
Fyr is by intention a small language that is easy to write and easy to read. It is very much inspired by GO. Unlike C++, Fyr offers no complex OO-constructs and no meta-programming capabilities. Unlike GO, Fyr offers templates, because they contribute to static type checking.
Fyr is a research project of the Distributed Systems research group at the University Duisburg Essen. Fyr is still in alpha status. The Fyr compiler for C99 is working, although not all planned features are imlemented yet. The WebAssembly backend is working for a subset of the language, but requires some more work.