Freestanding programming language: a high-ish-level language that has absolutely no need for any runtime support, designed to work well in scenarios where dragging along a language runtime is either not possible or simply unwanted.
This language is designed for:
- Operating system development
- Embedded software
- Integrating cleanly into existing software
- Abstractions must happen at compile time unless absolutely necessary
- Compiler must not generate any functions that the user does not write
- Compiler must avoid generating logic that the user does not write
You can install the compiler by running:
go install ./cmd/fsplc
fsplc program depends on the LLVM IR compiler (
llc). If it is not found,
it will attempt to use
clang instead but with some features disabled. Please
clang are installed and accessible from your PATH
before using this software.
fsplc program may be used as follows:
fsplc [ARGUMENT(S)...] FILE(S)...
The program compiles all input files into one output. The output file type is determined by the filename extension of the output file:
If no output file is specified, it will default to an object file with the name of the first input file.
Object files can be linked into an executable binary using the linker of your
choice, or by using a C compiler such as
clang -o OUTPUT INPUT.o
Using a C compiler will link the C standard library to your program, which may be useful for building normal user applications.
Learning the language
At this time, there is no guided method of learning how to write FSPL code.
However, a good place to start is the
design directory, which contains a
language specification among other things. The language specification goes into
detail about the syntax and semantics of the language, and assuming some
background in C programming, it should be enough to attain a reasonable grasp
of the language.
Note that the compiler is still relatively early in development, and has numerous bugs. In addition, language features and syntax are not yet set in stone and may change in the future. Please report any bugs you find to the issue tracker.
Late 2023 (These have been implemented):
- Top-level entities
- Type definitions
- Defined and external functions
- Type definitions
- Type system
- Strict, static, bottom-up type inference
- Expressions and control structures
- Literals adapt to types via bottom-up type inference
- Variable declaration
- Variable access
- Function calls
- Method calls
- Interface behavior calls
- Union types (carry type information)
- Match statements
- Mutable/immutable variables
- For/range loops
- Basic, non-final standard library routines
- Conditional compilation
- Shared library compilation
- FSPL vararg using Slices
- Optional per-function C-style vararg for compatibility
- Ownership system
- Lightweight, modularized (and of course, totally optional) standard library to replace those written in Q2
At the beginning of Q4 2024, a 1.0 version of the language will be released.