@bd I'm curious to hear your goals with this!

Here are mine: akkartik.name/post/wart; github.com/akkartik/mu/tree/ma. I suspect you might have a couple earlier ones of your own..

@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 Nice. I've never gotten to a Lisp compiler. CPS transforms and all that stuff.

@akkartik me neither! Which is why I’m exploring the area right now ;)

I’m case you are interested in something like that I found this very nice paper on the matter: scheme2006.cs.uchicago.edu/11-

@akkartik to be honest I started this exploration because I was wondering if I could compile a #uxn rom directly to assembly but I thought it would be nice to study the entire thing fresh.

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.

@bd Stack based compilers have almost a whole other parallel track of papers, I believe. @vertigo might have some guidance for you.

@akkartik @bd I don't really have any papers which come to mind right off hand.

Most Forth "compilers" are byte-code, direct-, indirect-, or subroutine-threaded implementations with precious little in the way of optimization. So, they err on the side of simplicity at the expense of performance.

Follow

@vertigo @akkartik @bd and most optimising Forth compilers are commercial products, so their source isn't available for study

Stephen Pelc wrote a very quick drive-through of the structure of VFX, but there's not much to glean from here: euroforth.org/ef00/pelc00a.pdf

and Anton Ertl has done some work on optimising threaded code - his papers are all at complang.tuwien.ac.at/projects (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 complang.tuwien.ac.at/forth/ but very dusty and unmaintained, or Marcel Hendrix's mxForth home.iae.nl/users/mhx/mxforth. 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

Sign in to participate in the conversation
OldBytes Space - Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!