Skip to main content


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
in reply to Devine Lu Linvega

@neauoire ☺️ do you think it it would be possible to modify/create quotations at runtime ? for example something like this :
[2] [3 +] concat i
Now they are just subroutines, we can't concatenate subroutines... Can you do that with lambdas ?
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.

This entry was edited (9 months ago)
in reply to Devine Lu Linvega

I made a joy-like where most operations are non destructive and reversible, so it doesn't need a GC, you might be able to use some ideas: https://git.sr.ht/~rabbits/yo-joy
This entry was edited (9 months ago)
in reply to Devine Lu Linvega

@neauoire ok ok. if i want to use a gc, i should represent quotations with cons cells then ?

Lo, thar be cookies on this site to keep track of your login. By clicking 'okay', you are CONSENTING to this.