Christoffer Lernö's Avatar
Christoffer Lernö
I started programming in the golden days of home computers in the 80s. I never really intended for a career as a programmer, instead I was planning on doing theoretical physics, but I got a job as a programmer almost by accident and here I am over 20 years later. I'm a co-founder of AEGIK AB, a small company that is doing consultant work and building games. I'm also working on the C3 language in my spare time.
Blog
Twitter account
The C3 Language
Member since

Recent Activity

I finally added a syscall compiler builtin:

View original message on Discord

Here is an example showing the latter but also clearly how the temp allocator can hand over to the backing allocator for pages which also gets cleaned up as needed:

View original message on Discord

Swapping the normal allocator for the temp one and clean after use:

View original message on Discord

Temp allocator with autoreleasing pools:

View original message on Discord

I bumped C3 to 0.3.0 basically it's just all that was after 0.2.0, which I first released as 0.2.1 0.2.2 etc. Even though I've had problems with eyestrain during and a lot of time spent is just thinking about how a feature should look, it ended up being a bunch of things added:

View original message on Discord

Some enum name reflection, with opt-out:

View original message on Discord

C3 doesn't have function overloading but:

View original message on Discord

Getting somewhere with the printf, the snippet below is now printing:

0: deadbeef 1: 0x00007ff7bf0b0608 🤣 [0x4d2] -43943922244 +123 -12 2: -43943922244 -43943 123 -12.300000 3: -1234.300000 你好 Hej 4: 1.230000 45.000000 1.23000 45.0000 1 45 2.382300e+02

View original message on Discord

Adding a string builder in the standard library for C3:

View original message on Discord

Converted the Raylib Arkanoid, which unearthed a bug in the ABI implementation! Excellent.

View original message on Discord

This is a first stab at a library description format for C3. This example defines only a single target (MacOS x64), but normally more are added. Using --lib raylib this definition would link libraylib.a + all of the MacOS frameworks. Note that rather than providing a statically allocated library, the same definition file could allow a directory of .c files or .c3 files to compile. Or link it dynamically.

View original message on Discord

Output

ERROR: '@require "d > 0" violated.'
  at function test::test (debugstuff.c3:4)
  at function test::main (debugstuff.c3:10)
  at function test::_$mainstub (debugstuff.c3:8)
View original message on Discord

This prints:

Assertion failed: (@require "baz > 100" violated: 'whatever'.), function test, file debugstuff.c3, line 6.
View original message on Discord

Just reducing the code output to LLVM on -O0 (an extreme case, reducing the number of instructions from 12 -> 3)

View original message on Discord

Some updates to the variant functionality - either get it as pointer or as the value copied to variable:

View original message on Discord

Not finished, but this prints

double 123.000000
int: 1
Unknown type.
View original message on Discord

Ranged case Output:

Something else: 0
1-3
1-3
1-3
4-10
4-10
4-10
4-10
4-10
4-10
4-10
Something else: 11
View original message on Discord

I've been implementing some of the programming language shootout tasks... here is mandelbrot:

View original message on Discord

C3 got string (actually slice) matching. This outputs

This works
This works too
Winning!
View original message on Discord

So this experimental stuff works now with this output:

Hex array: Open the pod bay doors
Base64 array: Open the pod bay doors
Multi line:
Say hello,
to my little friend...
Raw string: C:\foo\raw.dll
View original message on Discord

The whole new try stuff is added to C3 now, and I enhanced it a little:

View original message on Discord

A contributor made raylib bindings for C3: 🥳

View original message on Discord

First version of user defined foreach works, this prints

1
3
10
View original message on Discord

Thanks to the hard work by the contributor kvk1920 C3C is now up and running on Windows under Mingw and MSYS2 with CI! 🥳

View original message on Discord

I had to do ad hoc lexing for feature, but I'll end up reusing it for a lot of other compile time functions later on:

View original message on Discord

Doing test_param(11, 10); gives:

Assert violation 'Invalid input' on line 159, in file 'debugstuff.c3'.
View original message on Discord

This prints:

156: 
157: /**
158:  * @param x - one parameter
159:  * @param y - other parameter
               ^
(debugstuff.c3:159) Error: There is no parameter 'y', did you misspell it?
View original message on Discord

Getting more environment info available from inside of programs now.

View original message on Discord

So this now works, with an output of:

Repeat 1
Repeat 2
Repeat 3
Repeat 4
Repeat 5
Repeat 6
Repeat 7
Repeat 8
Repeat 9
Repeat 10
111 121 4 77 
View original message on Discord

I added this for enums, it's sometimes useful (printing Min -5 Max 14 Elements: 3)

View original message on Discord

Finally some generic module code up and running. Defining some parameterized functions and types.

View original message on Discord

Those cursed gradients are working again for text rendering:

View original message on Discord

Sum integers using recursion, slices and typed varargs... 😅 (call using sum_us(1, 3, 5, 11))

View original message on Discord

Ok so this works now, but it's using alloca to copy the slice. I don't know how I feel about that. In safe mode you'll get a panic if you exceed MAX_PARAMS, but currently not in non-safe. I might mask this though.

View original message on Discord

A goddarn miracle, C3 is using built in linking on Linux

View original message on Discord

Piecemeal adding some welcome library functionality while checking how the macros/function namespacing looks in the wild (not perfect yet):

View original message on Discord

Took a little while but constant aggregates are now spliced in a fairly efficient format from what I can see. This one would take gigabytes of memory to describe for Clang:

View original message on Discord

More and more debug info getting done in the C3 backend:

View original message on Discord