r/concatenative • • May 15 '20

A Survey Of Concatenative Programming Languages in 2020

40 Upvotes

What's the current state of the concatenative language world? Were are we in 2020? Were are we going, were should we be going?

To give an overview, I'm going to look at various categories of languages, although these categories will overlap significantly. The point is not so much to put languages into boxes, but to analyze the tendencies in the world of concatenative languages.

(And seriously, we need a shorter term than "concatenative languages"; suggestions welcome.)

I have certainly missed quite a few interesting projects, feel free to add them in the comments. In case I have included and misrepresented your project here, I'm sorry. I hope you would take that as an opportunity to clarify things.

The Classics

Of course, there is always Forth. With embedded systems, it found it's niche. I'm not going to list all relevant implementations here, because Forth is basically a group of languages on its own. I will, however, mention a few of the more unusual Forth-likes further below.

PostScript is widely used, yet mostly invisible. It has been said that the impressive thing about PostScript is really the design of the printing operations. That may well be true, since the more PDF is basically unrolled PostScript (i.e. without control structures) and is more popular, despite compressed PostScript files being smaller than PDFs. Unfortunately, this means that the concatenative nature of PostScript is probably not it's success factor.

And then we have Joy, which is basically unused itself, but is the mother of the modern wave of concatenative languages.

The Big General Purpose Players

Factor is Joy made practical. It's stats look impressive: 31,551 commits - 34 branches - 119 releases - 93 contributors - last commit: yesterday. That's what a healthy free software project looks like these days. Yet it seems there is not much of a community. Correct me if I'm wrong about this, but the factor community was way more active in the past. It also used to have a firm place in the TIOBE index (in places 50-100), but not anymore - while dead languages like Korn Shell and Standard ML are still in there. Why is this? I'm not sure myself, but while Factor has really cute code examples, I never found the real world code very readable, as I personally don't think higher-order programming makes concatenative languages easier to read for most people. So maybe it is limited to people who find juggling a stack in their heads natural. These people exist, but they are a minority for sure. Still, Factor has a lot of useful and well-designed libraries and is a powerful tool.

Kitten is well-known in our community as a language with an advanced type system (with some advantages over e.g. Haskell). Also, the marketing is advanced too; evincarofautumn just knows how to spark excitement. :) It has been worked on for a long time now, but there was not much progress reported for a while now. The last commit was seven months ago, but I think it had a few pauses with no public activity in the past, so I wouldn't worry about this too much. A critique of the language I've heard is that it has so much syntactic sugar that it could be argued that it is not really concatenative anymore. I leave others to decide on whether this is nitpicking or an important point. I would just want to add that most concatenative languages also have some non-concatenative features.

Actively Maintained / Developed

Feline is quite impressive, lots of work was put into this. Overall, it seems similar to Factor.

Min is both a concatenative language and a shell. The name and description confuse me a bit, since it doesn't seem to be tiny at all. (To clarify: Everything above 32K is not tiny to me.) However, it looks like a mature project that is worth checking out. Can be easiely embedded in Nim programs.

:r4 is inspired by ColorForth and has been in development for a long time now. It can actually do a lot of things, so if being unityped does not scare you off, I encourage you to take a deeper look!

Mirth is probably most similar to Kitten.

Retro is a modern Forth dialect running on a tiny virtual machine. It is actively used in production settings! Useful for desktop, mobile, servers and embedded. This probably should be more widely known.

Popr is... unique. I don't feel that I'm in a position to summarize what this is about, but it's something special.

Wok is my own brainchild (and therefore the best language ever, obviously). It combines the idea of a statically typed low-level language with the idea that programming might benefit by being both closer to the metal and closer to natural languages - in both superficial and deep ways. It has a direct mapping to assembly language and discourages deep nesting. I am also the first to acknowledge that stack juggling is a problem for readability, and I am working towards reducing its impact (without giving up on concatenativity). While actively being worked on, Wok is not usable yet. I've been really enthusiastic about it for a long time now, even though I didn't manage to work on it for several month during the past year. Note to myself: Get your shit together and make this useful!

Able is used internally by the company MERJ. It will be made public at some point, but that has been delayed for a while now. It seems to be a very innovative, non-standard dialect of Forth.

Teaching

Consize is (or was?) used at a German university, so it is seeing some actual use. Implemented in Clojure, it runs on the JVM. It supports continuations and has quite some useful tooling implemented in a few lines.

Embeddable

Dochi can be embedded in Haskell. Trith can be embedded in Ruby. Gershwin has interop with Closure. There are certainly many more like these.

Concatenative javascript follows an interesting idea: It is not a language in itself, but a library that allows you to write concatenative JavaScript code. I'm not sure why anyone would actually want to use this in production code, though. The same concept is implemented by Three pipes for Emacs Lisp and Copycat might do it for Scheme in the future. Something similar is done by Rex for Elixir, but I'm not sure if this is exactly the same as I don't speak Elixir.

Experimental

We have several languages which are rather academic. Joy and Popr mentioned above would fit this category, as well as various incomplete attempts to include dependent typing. But there are a few that deserve special mention:

XY is a slightly different take on how to evaluate a concatenative language. It is written in K, is also array-based itself and offers continuations.

Om is unusually minimal, consisting of only three syntactic elements. Functions manipulate the remainder of the program, making it a prefix-language. It can be embedded in C++ programs.

Specialized

This category has a large overlap with the previous one, but these are less academic.

Staapl "is a macro assembler on steroids for PIC18F microcontrollers."

xs and Lang5 are array languages. This is an interesting idea because it combines the conciseness of two paradigms. Also, array programming can be optimized very well for performance.

ColorForth is Chuck Moores philosophy put to the extreme. His philosophy is simplicity. He worked on simplifying things for his whole life. That's why his mind works differently from the rest of the industry. We should learn from him, even if we don't want to follow all his opinions.

A Concatenative URL Language is a weird idea, but might actually be useful for something. I'm just not yet sure for what. Essentially, this makes it a solution in search for a problem. Therefore I would classify it as "interesting, but not useful" - along with many other concatenative languages.

Ait allows you to draw on a canvas. Example here (evaluating it takes a moment).

RawrCat is a language for in-browser security analysis and visualization. The Readme says: "Because of its threading/coroutines and channel implementation, RawrCat is particularly well suited to processing and manipulating streams of data in a granular fashion, giving the user instantaneous feedback as it processes data."

Katlang is intended for code golf, i.e. writing very concise programs.

Push 3.0 is intended for use in "evolutionary computation systems (such as genetic programming systems), as the language in which evolving programs are expressed."

Ripple is a "functional, stack-based query language for Linked Data and other RDF data sources."

Toys

About 50% of concatenative languages I found were intended as toys only, with an additional 40% being abandoned in very early stages of development. I don't think this is a bad thing. It shows that implementing a concatenative language is generally considered an approachable task, which hints at a unique strength of the paradigm.

Other

Parable is a generic, garbage-collected concatenative language with an emphasis on higher-order programming. It was written by the author of Retro (see above). It seems quite nice actually.

Edsger shows how to do pattern matching in a concatenative language.

Elymas is a very opinionated, personal approach to programming.

Afterthoughts

My personal opinion is that the smaller the niche for a concatenative language, the bigger its chances for success. Since the implementation of these languages is particularly easy, they have the advantage over applicative languages in the same niche. On the other hand, many general purpose languages have had an incredible amount of work put into them, making the difference in the complexity of the core language irrelevant. So concatenative languages can hardly ever compete with them.

Since there will always be a demand for domain-specific niche languages, concatenative programming can thrive in this area. Languages like Cod or those in the "Specialized" section above therefore represent the approach that I think is most viable. What we need to do, though, is find ways to improve the usability, or as they say these days: the DX (developer experience).


r/concatenative • • Nov 17 '17

Video from a talk I gave at Stanford yesterday, “Concatenative Programming: From Ivory to Metal”

Thumbnail
youtu.be
22 Upvotes

r/concatenative • • Aug 25 '23

Factor 0.99 now available

Thumbnail re.factorcode.org
19 Upvotes

r/concatenative • • Jan 30 '25

Blang Concatenative, Stack-Oriented Programming Language for Computers

18 Upvotes

r/concatenative • • Sep 28 '23

Uiua! A New Stack-Oriented Array Language!

Thumbnail
youtube.com
18 Upvotes

r/concatenative • • Jun 17 '22

Soft-launch Boba: a statically-typed concatenative programming language

Thumbnail
github.com
18 Upvotes

r/concatenative • • Mar 02 '21

Lawvere: a new member of the categorical branch of the concatenative family

Thumbnail
github.com
17 Upvotes

r/concatenative • • Dec 14 '24

Introducing hex

Thumbnail hex.2c.fyi
16 Upvotes

I just released the first version of "hex"! A tiny, minimalist, "slightly-esoteric" concatenative programming language. Its syntax is inspired by another project of mine (min), but it is VERY minimalist and yet hopefully still fun to play with.

The site includes a short specification, a tutorial, a WASM-powered REPL playground, and the language itself is meant to be run (almost) anywhere.

The (deliberate) quirks are the following:

  • Support for 32bit integers in hex format only (and no floats), strings, and quotations.

  • Support for 0x40 (64) native symbols, and also user-defined symbols, but they are always global.

Overall it's meant to be really simple to implement and learn.


r/concatenative • • Jun 20 '24

First time I found a reference to Joy in the wild

15 Upvotes

I was visiting a building of a large IT company and noted that they named the meeting rooms after programming languages. These did not only include Lisp, XSLT and Plankalkül, but also Joy. As concatenative languages are often seen as really obscure, this made me happy. Seems we're no more obscure than Plankalkül now!


r/concatenative • • Apr 04 '23

Haystack: Statically typed, compiled, stack language

Thumbnail
github.com
15 Upvotes

r/concatenative • • Feb 18 '25

Equinox, a Forth Dialect for Retro GameDev

Thumbnail
github.com
14 Upvotes

r/concatenative • • Oct 12 '23

"Concatenative programming and stack-based languages" by Douglas Creager

14 Upvotes

A presentation at the Strange Loop Conference on "Concatenative programming and stack-based languages" by Douglas Creager: https://www.youtube.com/watch?v=umSuLpjFUf8

 


r/concatenative • • Jun 28 '22

Cognate - concatenative programming in English prose

Thumbnail cognate-lang.github.io
14 Upvotes

r/concatenative • • Feb 02 '22

min is a functional, concatenative programming language with a minimalist syntax, a small but practical standard library, and an advanced REPL

Thumbnail min-lang.org
14 Upvotes

r/concatenative • • Feb 12 '25

Advanced Typechecking for Stack-Based Languages

Thumbnail ryanbrewer.dev
13 Upvotes

r/concatenative • • Nov 20 '24

Yet another concatenative language - BUND

13 Upvotes

The BUND language is considered "yet another concatenative language," but it stands out in its design from many of its counterparts. First, it necessitates additional effort to define and restrict data context by utilizing both named and anonymous stacks. Furthermore, it introduces the concept of an isolated execution environment that is closely managed by the programmer.

https://crates.io/crates/bund


r/concatenative • • Aug 20 '26

Joy Programming Language in Java (Kotlin)

Post image
12 Upvotes

r/concatenative • • Jan 12 '23

cosh: concatenative command-line shell

Thumbnail
github.com
12 Upvotes

r/concatenative • • Apr 04 '21

f-flat-minor: learning new languages by implementing a mini "forth-like" language

Thumbnail
github.com
12 Upvotes

r/concatenative • • Jul 11 '19

GitHub - mirth-lang/mirth: Compiler for the Mirth programming language, a type-safe functional Forth.

Thumbnail
github.com
12 Upvotes

r/concatenative • • Mar 12 '17

Type Inference in Stack-Based Programming Languages

Thumbnail prl.ccs.neu.edu
12 Upvotes

r/concatenative • • Feb 02 '23

Aocla: A small stack based programming language interpreter in ~1KloC

Thumbnail
github.com
11 Upvotes

r/concatenative • • Apr 12 '21

Introducing Dawn (Part 1)

Thumbnail dawn-lang.org
11 Upvotes

r/concatenative • • Mar 01 '21

Foray: A toy stack-oriented language written in Zig (WIP)

11 Upvotes

I wanted to learn the zig language and I also decided to try making an interpreter for a stack-oriented concatenative toy language I'm calling Foray, mostly inspired by Forth and Min.

I have the rough design of the language out, plus a really basic interpreter and a really barebones repl written. I also have to implement better error handling because I've been lazy about that. But the core of it works and that makes me happy.

Short example:

(2 *) :double
2 double;

The snippet creates a list containing the number 2 and the * operator, then defines a variable double by popping that list and storing it in a dictionary. On the next line, it pushes a 2 onto the stack and then evaluates double. More specifically, it pushes the contents of double (a list) onto the stack, then pushes the ; operator which unpacks and evaluates the list in order (Lists are essentially quoted lists, and ; acts as an unquote).


r/concatenative • • Jun 20 '20

Xs: a concatenative array language inspired by kdb+ and FORTH

Thumbnail cryptm.org
11 Upvotes