Freestanding programming language
Go to file
2024-02-13 19:57:22 +00:00
analyzer Analyzer makes use of entity.FormatType 2024-02-12 14:47:49 -05:00
assets Add logo to readme 2024-01-25 07:42:32 +00:00
cli Add cli.NewValueSet() to validate against several values 2024-02-11 12:38:46 -05:00
cmd/fsplc Compiler now takes in a format override parameter 2024-02-11 12:55:43 -05:00
design Updated spec a little 2024-02-10 18:49:10 -05:00
entity Add entity.FormatType() 2024-02-12 14:34:49 -05:00
errors errors.Format does not crash when formatting normal error 2024-02-11 03:35:27 -05:00
generator New test for generator confirmed to work, filled out 2024-02-10 21:31:10 -05:00
integer Add doc comments to integer 2024-02-09 01:00:54 -05:00
lexer DESIGN.md -> README.md 2024-02-09 18:02:03 -05:00
llvm Remove llvm/README.md 2024-02-09 03:37:10 -05:00
parser OOPS 2024-02-10 18:57:53 -05:00
testcommon testcommon last column no longer has trailing spaces 2024-02-10 21:24:09 -05:00
.editorconfig Add .editorconfig 2024-02-10 19:03:38 -05:00
go.mod Go mod tidy. No more participle, officially! 2024-02-08 13:12:42 -05:00
go.sum Go mod tidy. No more participle, officially! 2024-02-08 13:12:42 -05:00
LICENSE License under GPLv3 2024-02-13 19:16:11 +00:00
README.md Add information (or lack thereof) of learning the language 2024-02-13 19:57:22 +00:00

FSPL

FSPL logo.

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

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

Installation

You can install the compiler by running:

go install ./cmd/fsplc

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.

Usage

The 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:

Extension Type
.s Native assembly
.o Object file
.ll LLVM IR

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:

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 docs 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.

Roadmap

Late 2023 (These have been implemented):

  • Top-level entities
    • Type definitions
      • Methods
    • Defined and external functions
  • Type system
    • Strict, static, bottom-up type inference
    • Pointers
    • Arrays
    • Slices
    • Structs
    • Interfaces
  • Expressions and control structures
    • Literals adapt to types via bottom-up type inference
    • Assignment
    • Variable declaration
    • Variable access
    • Function calls
    • Method calls
    • Interface behavior calls
    • Operations
    • Casting
    • Blocks
    • If/else
    • Loops

Q1 2024:

  • Union types (carry type information)
  • Match statements
  • Modules
  • Mutable/immutable variables
  • For/range loops

Q2 2024:

  • Basic, non-final standard library routines
  • Conditional compilation
  • Shared library compilation
  • Constants
  • Vararg
    • FSPL vararg using Slices
    • Optional per-function C-style vararg for compatibility

Q3 2024:

  • Generics
  • 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.