My little Lisp interpreter can now perform arithmetic operations.
@akkartik just experimenting for now, my goal is to understand better different moving parts of a programming language. The idea would be to get a full bootstrap interpreter going and then learning to generate x86_64 or ARM assembly after I got a self hosted compiler from it.
Additionally I want to be able to freely interop with C or ASM code and have ways of allocating and processing arrays for better performance.
@bd Yeah, good ol' Gholoum is a classic. I have a slightly unconventional opinion there. Gholoum and the whole nanopass idea is useful only if you're building your compiler in a HLL. (Which.. why would you?! IMHO.)
 My PhD was partly in compiler design. It took me 10 years to realize it didn't teach me very much at all about the subject.
@bd Compiler in a HLL makes a lot of sense for a prototype. But I have this whole belief system that production compilers (i.e. stuff people write code for) for HLLs built in other HLLs add a lot of noise to civilization's supply chains.
@akkartik yeah I mean I love to be closer to the metal myself. Building everything in C these days. I may hit you up for questions once I get this a bit more advanced haha.
A stack based language can actually be translated much easier to assembly it seems since I could just use the SP but this is also an opportunity for me to up my lisp-fu game.
@vertigo @akkartik @bd odd, can you see this thread? https://merveilles.town/web/statuses/107067889615510041
But, if you have enough registers, and you aren't afraid of letting the compiler keep track of some meta-data during compilation on a "compile-time stack" of sorts, it should be doable for most RPN-expressible programs.
For now I'm not working on the stack -> assembler, but my worry with using the SP is that maybe it could get dirty if we call for some syscalls or things like that? I have no idea TBH.
Stephen Pelc wrote a very quick drive-through of the structure of VFX, but there's not much to glean from here: http://www.euroforth.org/ef00/pelc00a.pdf
and Anton Ertl has done some work on optimising threaded code - his papers are all at http://www.complang.tuwien.ac.at/projects/forth.html (or follow links from there to his other bits)
occasionally, efforts at optimising Forth compilers have escaped into the public domain - for example Lars Kreuger's flk, which is available at https://www.complang.tuwien.ac.at/forth/ but very dusty and unmaintained, or Marcel Hendrix's mxForth http://home.iae.nl/users/mhx/mxforth.html which is even dustier
for optimising compilation of stack based languages in general, the Self papers and the work on Java JITs are probably the richest seams to mine
Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.