Freestanding programming language
Go to file
Sasha Koshka fb95b935d6 Merge pull request 'remove-participle' (#10) from remove-participle into main
Reviewed-on: sashakoshka/fspl#10
2024-02-08 18:34:18 +00:00
analyzer Fix TestTypeInterfaceBehaviorUniqueErr 2024-02-08 12:57:20 -05:00
assets Add logo to readme 2024-01-25 07:42:32 +00:00
cmd/fsplc Oops pt 2 2023-12-13 03:40:40 -05:00
design Changed my mind about brackets on break and return statements 2023-12-12 19:51:17 -05:00
entity Change interface prefix from ? to ~ 2024-02-08 04:10:11 -05:00
errors I want to look at my juicy error formatting even when it passes 2024-02-06 22:33:18 -05:00
generator Fixed all generator tests 2024-02-08 13:32:04 -05:00
integer Add package for determining integer sizes 2023-10-27 16:10:05 -04:00
lexer Token.Is and Token.ValueIs work properly 2024-02-06 23:16:48 -05:00
llvm Fixed extra lines after IR blocks 2024-01-28 03:18:39 -05:00
parser Fixed commaList 2024-02-08 13:32:15 -05:00
testcommon Put functionality from generator/test-common.go in its own package 2024-02-01 01:59:17 -05:00
README.md Replace bugs section with caveats in README 2024-01-26 22:11:35 +00: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

README.md

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.

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

Early 2024

  • Union types (carry type information)
  • Match statements
  • Modules
  • Vararg
  • Lightweight, modularized (and of course, totally optional) standard library
  • Conditional compilation
  • Constants
  • For loops
  • Range loops

Afterwards

  • Generics?
  • Ownership system?
  • And more!