I've written my first toy compiler ! it takes a Joy-like language as input, and outputs uxntal. For the moment it doesn't do much, but it can compile factorial and fibonacci ☺️
#uxn
https://github.com/max22-/compiler
#uxn
https://github.com/max22-/compiler
GitHub - max22-/compiler
Contribute to max22-/compiler development by creating an account on GitHub.GitHub
Devine Lu Linvega
in reply to max22- • • •max22-
in reply to Devine Lu Linvega • • •[2] [3 +] concat i
Now they are just subroutines, we can't concatenate subroutines... Can you do that with lambdas ?
Devine Lu Linvega
in reply to max22- • • •yeah, you could.
Because concat doesn't need more memory cells, so you could transform
{ #0002 } { #0003 LIT ADD2 }
6000 04a0 0002 6c60 0005 a000 0338 6c
into
{ #0002 #0003 ADD2 JMP2r }
6000 08a0 0002 a000 0338 6c
and pad the remaining cells with NOPs, or a cap with a jump.
But normally, you'd want to use a garbage collector for doing that sort of state transformation.
Devine Lu Linvega
in reply to Devine Lu Linvega • • •~rabbits/yo-joy - Combinatory logic playground, written in Tal - sourcehut git
git.sr.htmax22-
in reply to Devine Lu Linvega • • •Devine Lu Linvega
in reply to max22- • • •