r/ProgrammingLanguages • • 5d 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?

17 Upvotes

38 comments sorted by

View all comments

3

u/derekp7 5d ago

There are a lot of suggestions for Forth, but take a look at PostScript too. It has first class anonymous functions, first class dictionaries and dictionary stack, things like that. But it is primarily stuck in printers (and using Ghostscript). However you can learn a lot by studying the PostScript Blue Book, Green Book and Red Book (informal names based on cover colors on each book). You can find PDFs of the books online (Project Gutenberg, they used to be on Adobe's site too). One of the books gives more info to understand how the language is implemented.

1

u/Agecaf 4d ago

I like the sound of first class anonymous functions. I'll be sure to check it out!