The introductory Rebol (see RebolLanguage
) book describes Rebol as a MinimalistLanguage
, which highlights the fact that the footprint of the code needed to implement Rebol is very small (200K or so).
Other languages share this characteristic, for example ArthurWhitney
's K (see KayLanguage
) is implemented in a download that is 128k.
implementations are typically very small, usually under 8k, suitable for microcontrollers. ColorForth
is even more minimal: a 2k kernel with a few K more source for utilities. And this isn't just the language, it's the whole PC operating system! Minimal to an extreme. ColorForth
's primitives are also an x86 implementation of ChuckMoore
's 31 op minimal instruction set for his custom MISC Forth chips.
Many embedded languages are minimal, simply to fit into the space alloted. StampBASIC comes to mind.
Some minimalist languages are intended for scripting a project in another language (i.e., AlternateHardAndSoftLayers
is a 200k-ish library that gives a project a scripting engine somewhat like PythonLanguage
is also typically used this way.
This seems to be a different characteristic than that being discussed in LittleLanguage
---as it is principally defined by the size of the implementation. There is no particular limit on size to qualify, although one might think, in today's terms, of anything less than 1mb in size as being reasonably minimalist.
It is also not the same as a "small language" as discussed in LargeAndSmallLanguages
. That sense of "small" is about the size and simplicity of the language specification (SchemeLanguage
being a good example), rather than the size of an implementation.
<Puts on old-fogey hat>: The first C compiler I wrote ran in less than 32K, including its own object code, runtime and working memory. And that's still 8 times the famous Altair Basic. -- PaulHudson
<Puts on old-fogey hat that is even more tattered>32K was the size of the MIT 704's memory that later ran the first time-sharing system at MIT. Our first computer back then was a 4K (18 bit words) precursor of the PDP-1. It was truly minimalist, with 4 instructions. Did a lot of work, too, although multiplying two numbers took a 70+/- instruction program. -- DavidNess
<Puts on young weirdo hat>: Urban Mueller's TuringComplete BrainfuckLanguage has often been implemented in under 256 bytes. -- DanielCristofani?
- Yeah, but that's in the category of languages where writing "hello world" is longer than the language implementation itself!!!
Two things I find help in defining a minimalist language (syntax-wise) is farming as much as possible off to the libraries instead of making dedicated syntax, and the usage of a DictionaryDataStructure
for just about everything beyond simple variables, including objects and "regular" arrays.
Example of using library instead of dedicated syntax:
if a in b, c, d, e then .... // dedicated "in" syntax
if in(a,b,c,d,e) then .... // use library routine instead of special syntax
One hazard of this is the problem Pascal had - every vendor defined output in a different way, so you were required to edit your code to port to a different Pascal compiler, just to get the printouts to work. If the language is under some control (Java, Python), this can be avoided.
If you know that may be an issue, then create your own output wrapper function/class so that you reduce the places that need changing per vendor. It doesn't always work out so neatly, but does improve your odds.
Interesting question: the most simplest "usable" language. There seems to be a dilemma. Either you include built-in constructs like IF and WHILE, or you make the language powerful enough to be able to define those (or their equivalents) using the base building blocks and sticking them in the default library. The first adds complexity by including those constructs, but the second spends complexity on genericness. Can strings and Eval alone be used to build those? Or do you just end up manually quoting everything?
Define "simple". Define "usable". Define Universe, and give three examples. Complexity has to go somewhere. You can push it around a lot, but it has to be somewhere. It could be in the number of language constructs, in the power of the few, simple, generic constructs, or in the code you write to overcome the excess simplicity of the language.
Yes, you can implement Blub in Blub, but until you have a Blub interpreter or compiler you're still a bit stuck ...
I've also had this debate about conservation of complexity with various people, but a lot of complexity comes from using inappropriate tools...
Just provide built-in lambdas, pattern matching, and user-defined types. Have a standard IO library, or the language will be useless. Maybe have integers if your users care about speed, and arrays if they care a lot about speed, but Peano arithmetic and LinkedLists can handle that. Maybe it takes less to be Turing complete, but it is the minimum needed to easily write your own if statement and while loop, and from there you can do anything.
The goal of StepsTowardTheReinventionOfProgramming
was also along the lines of making good use of less lines of code.
See also MinimalTable