Skip to content

Core 0.2.0

Choose a tag to compare

@zweiler1 zweiler1 released this 20 Aug 11:05
· 1248 commits to main since this release
4892950

Changelog

  • Added installation script for a one-line installation on Windows (https://github.com/flint-lang/flint/releases/tag/installer)
  • Added proper syntax highlighting to the Flint Wiki (https://flint-lang.github.io)
  • Added version selection to the Flint Wiki
  • Changed the TokenContext vector from strings to string views into the source code
  • Completely overhauled and refactored the compile error output, the compiler now produces proper compile errors.
    The faulty source file:
use Core.print
use Core.wololo

def main():
	print("Hello, World!\n");

The old error output:

Custom Error: 2
Custom Error: 2
Custom Error: 2
Custom Error: 2
Parse Error at test_files/test_minimal.ft:9:21
 -- Failed to parse expression: vec4 . (x, y, z, w);

Parse Error at test_files/test_minimal.ft:9:21
 -- Failed to parse expression: vec4 . (x, y, z, w);

Custom Error: 2
Parse Error at test_files/test_minimal.ft:9:5
 -- Failed to parse statement: (x, y, z, w) := vec4 . (x, y, z, w);

Parse Error at test_files/test_minimal.ft:5:5
 -- Failed to parse body:
TODO

The new error output:

Parse Error at test_files/test_minimal.ft:2:10
└─┬┤E0000│
2 │ use Core.wololo
┌─┴──────────┘
├─ The Core module 'wololo' does not exist
└─ Available Core modules are
    ├─ assert
    ├─ env
    ├─ filesystem
    ├─ print
    ├─ read
    └─ system
  • Added ability to switch on multiple values in "normal" switch statements / expressions (it only worked on enums until now)
  • Added ability to cast between error set types. You now can upcast an error to one of the error set types in its "inheritance chain"
  • Changed all internal strings to be global strings, which makes the IR code much more readable and reduces string duplication to a minimum, every string literal is now unique in the binary
  • Added grouped "field access" for enum literals to create enum literal groups directly
  • Added ability to compare homogeneous groups to scalar values for set-like comparisons:
use Core.print

enum MyEnum:
    VAL1, VAL2, VAL3, VAL4, VAL5;

def main():
    i32 x = 5;
    if x == (3, 4, 5):
        print("{x} is 3, 4 or 5\n");
        
    MyEnum me = MyEnum.VAL4;
    if me != MyEnum.(VAL1, VAL2, VAL3):
        print("{me} is neither VAL1, VAL2 or VAL3\n");
  • Added tuple to group casting parsing and code genration support, it's now possible to "extract" all values of a tuple natively
  • Updated the multi-type field accessors to be more industry-standard:
- ...x2: (x, y), (i, j), (u, v), (s, t), ($0, $1)
- ...x3: (x, y, z), (i, j, k), (r, g, b), (s, t, p), ($0, $1, $2)
- ...x4: (x, y, z, w), (r, g, b, a), (s, t, p, q), ($0, $1, $2, $3)
  • Fixed bug where types in string interpolations could not be resolved
  • Fixed bug where a * or / character within a multi-line comment would end the comment immediately
  • Fixed bug where the multi-line comment would prevent all tokens after the comment to be parsed
  • Fixed bug where no EOL token would be added after a "normal" line before the start of a multi-line comment
  • Fixed bug in the switch statement code generation which would clear the scope twice leading to double-free bugs
  • Fixed bug where the thrown error variable would be freed at the end of the function, now every variable that's thrown will be excluded from being freed
  • Fixed compile error printing of the Lexer, which would hard crash. The Lexer will not print error messages as pretty as the Parser because the file it lexes is not complete
  • Fixed group to tuple casting code generation
  • Fixed bug which prevented void returns to work (return;)
  • Fixed bug which crashed the compiler when trying to do a grouped access on multi-types
  • Fixed bug where the --run flag would not work on Windows

Full Changelog: v0.1.6-core...v0.2.0-core