Skip to content

Core 0.2.4

Choose a tag to compare

@zweiler1 zweiler1 released this 15 Nov 19:40
· 1069 commits to main since this release
0cfbadc

Changelog

  • Updated Windows installer to:
    • Automatically download and install the fls alongside the flintc compiler
    • No longer provide flintc.cmd and fls.cmd wrappers, since the fls does not work with VSCode when it's a wrapper
    • Made the flintc.exe and fls.exe hard links to the correct version instead
    • Now they both can be executed by just typing flintc or fls into any terminal
    • They now also work in any CommandPrompt in addition to the PowerShell
    • LSP setup now does not require any additional work other than using the windows installer of Flint + installing the VSCode extension for syntax highlighting
  • Completely refactored the literal system (more information)
  • Changed integer and floating point literals to be arbitrary precision at compile-time
  • Added the new int and float types for the compile-time arbitrary precision integer and floating point literals
  • Added proper size-checking for the literals when using them in a typed context, e.g. doing var + 300 when var is of type u8 will now result in a compile-time error
  • Implemented the 16-Byte Rule for SystemV ABI compliancy. When using FIP to call into external C code structures larger than 16 bytes now can be passed to extern defined functions and be returned from them too
  • Added pointer types to Flint: T*, they can ONLY be used in extern contexts, e.g. when defining extern functions or when calling them
  • Added the reference-of operator & to be able to reference variables of type T to get an result of type T*. Because of the above mentioned rule that pointers are only allowed in extern context, using the & operator outside of calling extern functions will lead to a compilation error
use Core.print

extern def inc_x(mut i32* x);

def main():
	i32 x = 10;
	inc_x(&x);
	print($"x = {x}\n");
void inc_x(int *x) {
    (*x)++;
}

will print x = 11 to the console.

  • Added new Analyzer class and in-between step (after parsing, before code-gen) to ensure no pointer-related operations are used outside of their allowed cases
  • Added tuple support to FIP, you now can define extern functions with tuple parameters (and return groups from extern functions)
use Core.print

extern def do_something(data<i32, i32, f32, bool> d) -> (i32, i32, f32, bool);

def main():
    d := (10, 10, 3.2, false);
    print($"d.($0, $1, $2, $3) = ({d.$0}, {d.$1}, {d.$2}, {d.$3})\n");
    d = do_something(d);
    print($"d.($0, $1, $2, $3) = ({d.$0}, {d.$1}, {d.$2}, {d.$3})\n");
#include <stdbool.h>

typedef struct {
    int x, y;
    float speed;
    bool is_something;
} MyData;

MyData do_something(const MyData md) {
    MyData result = {0};
    result.x = md.x + 2;
    result.y = md.y + 5;
    result.speed = md.speed / 2;
    result.is_something = true;
    return result;
}

prints

d.($0, $1, $2, $3) = (10, 10, 3.2, false)
d.($0, $1, $2, $3) = (12, 15, 1.6, true)

because tuples are just structs in the view of FIP

  • Completely overhauled the polymorphic variation system, for more information see here
  • Fixed the fsh example project, it was unable to compile prior
  • Fixed bug where multiplying two unsigned integer values would lead to a division by zero error if the left hand side was 0
  • Fixed bug where the & symbol was recognized as a BIT_OR instead of BIT_AND token

Full Changelog: v0.2.3-core...v0.2.4-core