Conversation

currently writing a compiler :)

2
0
1

@kemona_halftau it gets better.

I wrote the lexer, parser, and codegen code entirely from scratch. in C. it only depends on a host C compiler and libc.

1
0
0

@kemona_halftau also it is currently less than 60kb for the entire compiler program which is pretty cool, although it will definitely increase over time.

at least with the current (prototype) c implementation of the compiler, I don't think the compiler will ever be larger than 500kb.

1
0
0

@noisytoot @kemona_halftau I was referring to the compiler executable, but the source code is very small too.

however, once I rewrite the compiler to make the language self-hosting, the source code and binary size will definitely grow quite a bit, as that's when I will implement all of the heavyweight features such as native compiler backends - the c implementation of the compiler just transpiles code into c.

1
0
1
@hexaheximal @kemona_halftau please keep the self-hosted compiler compilable with a non-self-hosted one to avoid having a huge rust-style bootstrap chain where you have to compile every previous version of the compiler in order to bootstrap the compiler entirely from source (or even worse, not publishing the initial non-self-hosted compiler and having no full-source bootstrap chain at all, like dotnet and GNAT)
1
0
1

@noisytoot @kemona_halftau I'm actually going to take an approach similar to zig, but without webassembly. the c implementation of the compiler will be left unmaintained with no compatibility guarantees once the self-hosted compiler is ready, but the self-hosted compiler will be able to emit standard C code that you can use to bootstrap the self-hosted compiler from.

(in practice, this means that you would be able to bootstrap the latest version directly from any standard c toolchain.)

1
0
1
@hexaheximal @kemona_halftau not good enough for preventing trusting trust attacks or for guix (seemingly the only distro that actually takes bootstrapping seriously) :(

I prefer hare's approach of having a maintained bootstrap compiler written in c and ensuring that the self-hosted compiler remains compilable with it
1
0
1

@noisytoot @kemona_halftau you will (obviously) still be able to bootstrap the compiler from the c implementation by compiling every intermediate compiler version with major breaking changes, but you won't have to, and I'd argue you probably shouldn't.

because the compiler is deterministic, trust is not a practical issue - it's reproducibly emitting c code, so it would not be very difficult to read it.

1
0
1
long grep output
Show content

@hexaheximal @kemona_halftau guix takes the long (full source bootstrap) path for zig, it probably would here too

> grep '(define zig' gnu/packages/zig.scm
(define zig-0.10-libc-abi-tools
(define zig-0.10
(define zig-0.10.0-538-source
(define zig-0.10.0-539-patch
(define zig-0.10.0-542-patch
(define zig-0.10.0-610
(define zig-0.10.0-675
(define zig-0.10.0-722
(define zig-0.10.0-747
(define zig-0.10.0-748
(define zig-0.10.0-851
(define zig-0.10.0-853
(define zig-0.10.0-961
(define zig-0.10.0-962
(define zig-0.10.0-1027
(define zig-0.10.0-1073
(define zig-0.10.0-1497
(define zig-0.10.0-1505-source
(define zig-0.10.0-1506
(define zig-0.10.0-1637-source
(define zig-0.10.0-1638
(define zig-0.10.0-1657
(define zig-0.10.0-1681
(define zig-0.10.0-1712
(define zig-0.10.0-1713
(define zig-0.10.0-1888
(define zig-0.10.0-1891
(define zig-0.10.0-2558
(define zig-0.10.0-2565-source
(define zig-0.10.0-2566
(define zig-0.10.0-2571
(define zig-0.10.0-2796-source
(define zig-0.10.0-2797
(define zig-0.10.0-2824-source
(define zig-0.10.0-2838
(define zig-0.10.0-3660
(define zig-0.10.0-3726
(define zig-0.10.0-3728
(define zig-0.10.0-3807
(define zig-0.10.0-3813
(define zig-0.10.0-3980
(define zig-0.10.0-3985
(define zig-0.11.0-149
(define zig-0.11.0-384
(define zig-0.11.0-494
(define zig-0.11.0-587
(define zig-0.11.0-631
(define zig-0.11.0-638
(define zig-0.11.0-702
(define zig-0.11.0-761
(define zig-0.11.0-1967
(define zig-0.11.0-3245
(define zig-0.11.0-3344
(define zig-0.11.0-3501
(define zig-0.11.0-3503
(define zig-0.11.0-3506
(define zig-0.11.0-3604
(define zig-0.12.0-109
(define zig-0.13.0-286
(define zig-0.13.0-503
(define zig-0.13.0-1323
(define zig-0.13.0-1528
(define zig-0.13.0-1951
(define zig-0.13.0-1952
(define zig-0.13.0-2795
(define zig-0.13.0-2899
(define zig-0.13.0-2924
(define zig-0.13.0-2925
(define zig-0.13.0-3252
(define zig-0.14.0-0
(define zig-0.14.0-687
(define zig-0.14.0-877
(define zig-0.14.0-930
(define zig-0.14.0-934
(define zig-0.14.0-1091
(define zig-0.14.0-1197
(define zig-0.15.0-0
(define zig-0.15.0-1447
(define zig-0.15.0-1459
(define zig-0.15.0-2738
(define zig-0.15.0-2807
(define zig-0.15.0-2821
(define zig-0.15.0-2876
(define zig-0.11-libc-abi-tools
(define zig-0.12-libc-abi-tools
(define zig-0.13-libc-abi-tools
(define zig-0.14-libc-abi-tools
(define zig-0.15-libc-abi-tools
(define zig-0.16-libc-abi-tools
1
0
1

@noisytoot @kemona_halftau in my opinion, transpiling it to C would still be a form of source code bootstrap - it's just a different language.

specific distributions may choose the more painful route if desired, but that's their problem, not mine. my goal is to make this a language that is relatively easy to use, and part of that is making it easy to bootstrap the compiler.

1
0
1
@hexaheximal I wouldn't call transpiled C source code. It may (or may not, depending on the implementation) be more readable than machine code or assembly, but it's still not the preferred form for making modifications, which is how I (and the GPL) would define source code. A handwritten (in a hex editor) ELF binary would still be source, but transpiled C is not.
1
0
1

@noisytoot that is true, I'll admit. I didn't think of that.

I think it will probably just be like zig then - quick bootstrap path for most users, and a chain of historical versions for full source bootstrap for those who want it.

0
0
1

@hexaheximal I saw it yesterday while browsing your codeberg profile. I'm working on an interpreter at the moment

0
0
0