We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
Example-based language
- This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
An example-based language is a language defined using a specific command or syntax for each program it can run; in other words, the language can only implement a few different programs and defines an arbitrary source code corresponding to each of them. Such languages are normally unusable for programming, unless you happen to need one of the few programs they are capable of implementing.
Example-based languages are often generalized to allow running more than one of the programs they can implement (or the same program multiple times) by concatenating the source code corresponding to multiple programs, but typically choose programs to implement that do not interact with each other, in which case this does not meaningfully increase their computational class.
The most famous example (and possibly the original) is HQ9+. This is not a pure example-based language because multiple + commands do interact with each other (they each increment the same accumulator), but because there is no way to read the accumulator, the + command is mostly a joke which highlights the arbitrariness of the rest of the language.
Unless one of the example programs is a programming language interpreter, example-based languages tend to belong to a nonstandard computational class (because with most non-example-based languages, being able to implement a program means that the language can also implement other similar programs, but this is not true for example-based languages which can only implement their examples).