Freestanding programming language
Go to file
2024-04-19 08:31:57 +00:00
analyzer Fix analyzer tests that used "switch" as function name 2024-04-02 02:59:49 -04:00
assets Add logo to readme 2024-01-25 07:42:32 +00:00
cli Cli now handles printing stuff 2024-02-22 21:24:07 -05:00
cmd Add option to specify module search paths manually 2024-03-27 13:13:22 -04:00
compiler It is now possible for tests to pass on windows 2024-03-31 01:33:28 -04:00
design Capitalize W*ndows 2024-04-02 18:36:52 +00:00
entity Untested analysis of switch statements 2024-03-25 12:08:28 -04:00
errors Changed repository import paths 2024-02-22 19:22:53 -05:00
generator Updated readme (conditional comp. -> GOOS/GOARCH) 2024-04-09 19:00:59 +00:00
integer Add doc comments to integer 2024-02-09 01:00:54 -05:00
lexer Lexer skips over zero runes now 2024-02-23 01:08:58 -05:00
llvm Remove llvm/README.md 2024-02-09 03:37:10 -05:00
parser Update FSPL parser readme 2024-04-03 11:04:14 -04:00
testcommon Add testcommon.CompareHex 2024-02-26 14:22:33 -05:00
.editorconfig Add .editorconfig 2024-02-10 19:03:38 -05:00
go.mod Changed repository import paths 2024-02-22 19:22:53 -05:00
go.sum Changed go.mod version to 1.19 2024-02-21 13:49:46 -05:00
LICENSE License under GPLv3 2024-02-13 19:16:11 +00:00
README.md Clarify install instructions in README.md 2024-04-19 08:31:57 +00:00

FSPL

FSPL logo.

Go Reference

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

Before installing the compiler with go install, you will need to install the Go programming language on your system. Afterwards, you can install the compiler and associated tooling by running:

go install ./cmd/*

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)...] ADDRESS

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:

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 nickname of the input address. For more information on how to use the fsplc program, run fsplc --help.

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

Roadmap

Q4 2023:

  • Type definitions
  • Methods
  • Defined and external functions
  • Strict, static, bottom-up type inference
  • Pointers
  • Arrays
  • Slices
  • Structs
  • Interfaces
  • Integer, floating point, string, struct, and array Literals
  • Assignment
  • Variables
  • Function, method, and interface behavior calls
  • Operations
  • Casting
  • Blocks
  • If/else
  • Loops

Q1 2024:

  • Union types (carry type information)
  • Match statements
  • Modules
  • For/range loops
  • Switch statements

Q2 2024:

  • Mutable/immutable variables
  • Basic, non-final standard library routines
  • Conditional compilation
  • Shared library compilation
  • Constants
  • ABI documentation

Q3 2024

  • 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

At the beginning of Q4 2024, a 1.0 version of the language will be released.

FAQ

I have either been asked these questions, or expect to be at some point.

What happened to ARF?

A couple of years ago, I attempted to create a programming language under the name ARF, with the goal of trying out some new and interesting syntax I'd come up with. I made several attempts to build a working compiler for it, but never quite succeeded. When I entered my senior year at university, I decided to have another crack at it as my senior project. By then, the ideas I had for the language had changed so much, it was basically a Ship of Theseus situation and it really just needed a new name altogether. Plus, ARF never really stood for anything in the first place.

Why Go?

Out of all the languages I know, I probably know Go the best. It was an obvious choice for making something this complex. However, I'd like to self-host the compiler eventually.

I know you as X name from Y place, why is your name here Sasha Koshka?

I consider it a bad idea to share your real name over the internet.