fspl/README.md

117 lines
3.7 KiB
Markdown
Raw Normal View History

2023-10-07 05:55:33 +00:00
# FSPL
2024-01-25 07:43:21 +00:00
<img src="assets/fspl.svg" width="128" alt="FSPL logo.">
2024-01-25 07:42:32 +00:00
2024-03-01 05:24:04 +00:00
[![Go Reference](https://pkg.go.dev/badge/git.tebibyte.media/fspl/fspl.svg)](https://pkg.go.dev/git.tebibyte.media/fspl/fspl)
2023-10-07 05:55:33 +00:00
Freestanding programming language: a high-ish-level language that has absolutely
no need for any runtime support, designed to work well in scenarios where
2023-12-08 05:28:58 +00:00
dragging along a language runtime is either not possible or simply unwanted.
2023-10-07 05:55:33 +00:00
This language is designed for:
- Operating system development
- Embedded software
2023-12-08 05:28:58 +00:00
- Integrating cleanly into existing software
2023-10-07 05:55:33 +00:00
## Design Principles
- 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
2023-12-08 05:28:58 +00:00
## Installation
You can install the compiler by running:
`go install ./cmd/fsplc`
2023-12-13 08:44:57 +00:00
The `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
ensure either `llc` or `clang` are installed and accessible from your PATH
before using this software.
2023-12-08 05:28:58 +00:00
## Usage
The `fsplc` program may be used as follows:
2024-03-19 19:13:07 +00:00
`fsplc [ARGUMENT(S)...] ADDRESS`
2023-12-08 05:28:58 +00:00
2024-03-19 19:13:07 +00:00
The program compiles the unit with the specified address into one output file.
The output file type is determined by the filename extension of the output file:
2023-12-08 05:28:58 +00:00
| Extension | Type |
| --------- | --------------- |
| .s | Native assembly |
| .o | Object file |
| .ll | LLVM IR |
2024-03-19 19:13:07 +00:00
If no output file is specified, it will default to an object file with the
nickname of the input address.
2023-12-08 05:28:58 +00:00
Object files can be linked into an executable binary using the linker of your
choice, or by using a C compiler such as `clang`:
`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.
2024-02-13 19:58:28 +00:00
## Learning the language
At this time, there is no guided method of learning how to write FSPL code.
2024-02-13 19:58:28 +00:00
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.
## Caveats, Bugs
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](https://git.tebibyte.media/sashakoshka/fspl/issues).
2023-12-13 08:44:57 +00:00
2023-10-07 05:55:33 +00:00
## Roadmap
2024-03-07 23:20:06 +00:00
Q4 2023:
- [x] Type definitions
- [x] Methods
- [x] Defined and external functions
- [x] Strict, static, bottom-up type inference
- [x] Pointers
- [x] Arrays
- [x] Slices
- [x] Structs
- [x] Interfaces
- [x] Integer, floating point, string, struct, and array Literals
- [x] Assignment
- [x] Variables
- [x] Function, method, and interface behavior calls
- [x] Operations
- [x] Casting
- [x] Blocks
- [x] If/else
- [x] Loops
2023-10-07 05:55:33 +00:00
2024-02-13 19:40:51 +00:00
Q1 2024:
2024-03-07 23:20:06 +00:00
- [x] Union types (carry type information)
- [x] Match statements
- [x] Modules
2024-03-19 18:39:52 +00:00
- [ ] For/range loops
2024-02-13 19:40:51 +00:00
Q2 2024:
2024-03-19 18:30:05 +00:00
- [ ] Mutable/immutable variables
2024-03-07 23:20:06 +00:00
- [ ] Basic, non-final standard library routines
- [ ] Conditional compilation
- [ ] Shared library compilation
2024-03-19 18:39:29 +00:00
- [ ] Constants
2024-03-19 18:42:33 +00:00
- [ ] ABI documentation
2024-03-19 18:30:05 +00:00
Q3 2024
2024-03-07 23:20:06 +00:00
- [ ] Vararg
- [ ] FSPL vararg using Slices
- [ ] Optional per-function C-style vararg for compatibility
- [ ] Generics
- [ ] Ownership system
- [ ] Lightweight, modularized (and of course, totally optional) standard library to replace those written in Q2
2023-10-07 05:55:33 +00:00
2024-02-13 19:40:51 +00:00
At the beginning of Q4 2024, a 1.0 version of the language will be released.