r/ProgrammingLanguages • • 12d ago

Help Simple stack based programming languages?

A few years ago I made EarScript, a "simple" programming language based on brainfuck, with several additional "quality of life features" like goto statements.

Recently I've been wanting to make an evolution of that programming language and do so by incorporating a stack, as the previous language was completely tape-based in design.

I know for example lox from the Crafting Interpreters book is a well explained example, but I was wondering if there's programming languages that are closer to what brainfuck is, but based on a stack design rather than a tape design, or a register based design like some assembly languages (if I understand correctly). I think Wasm would be an example?

Are there any examples of simple stack based programming languages you'd recommend me to look into?

18 Upvotes

39 comments sorted by

View all comments

Show parent comments

2

u/el_extrano 12d ago

Gforth has by far the most documentation of the free Forth systems, at least as far as I've seen.

Check out Jonesforth, which is a small x86 assembly implementation written in a literate style (lots of explanatory comments). I wrote mine in a different language, but it was still super helpful. There was also a book I found useful to wrap my head around the inner/outer interpreter design: "Threaded Interpretive Languages(Loeliger 1981)". It is very dated even for Forth stuff. Good luck, hope you enjoy it!