fspl

module
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 31, 2024 License: GPL-3.0

README

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

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

Directories

Path Synopsis
Package analyzer implements the semantic analysis stage of the FSPL compiler.
Package analyzer implements the semantic analysis stage of the FSPL compiler.
cmd
fsplc
fsplc compiles FSPL programs.
fsplc compiles FSPL programs.
fsplmod
fsplmod manages FSPL modules.
fsplmod manages FSPL modules.
Package compiler is responsible for orchestrating the different FSPL compilation stages, as well as invoking the LLVM IR compiler.
Package compiler is responsible for orchestrating the different FSPL compilation stages, as well as invoking the LLVM IR compiler.
native
Package native provides OS native parameters for the compilation process.
Package native provides OS native parameters for the compilation process.
Package entity provides data representations of language concepts.
Package entity provides data representations of language concepts.
Package errors provides a location tracking and error formatting system.
Package errors provides a location tracking and error formatting system.
Package generator implements the code generation stage of the FSPL compiler.
Package generator implements the code generation stage of the FSPL compiler.
native
Package native provides a generator target describing the current system.
Package native provides a generator target describing the current system.
Package integer provides utilities for working with integer data.
Package integer provides utilities for working with integer data.
Package lexer implements the lexical analysis stage of the FSPL compiler.
Package lexer implements the lexical analysis stage of the FSPL compiler.
Package llvm provides a way to build and write out LLVM modules.
Package llvm provides a way to build and write out LLVM modules.
Package parser defines basic parser utilities.
Package parser defines basic parser utilities.
fspl
Package fsplParser implements the parsing stage of the FSPL compiler.
Package fsplParser implements the parsing stage of the FSPL compiler.
meta
Package metaParser provides parsing for FSPL module metadata files.
Package metaParser provides parsing for FSPL module metadata files.
Package testcommon provides re-usable unit testing functionality.
Package testcommon provides re-usable unit testing functionality.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL