5 ms·
Ask HN: What is the smallest possible language?
I've been thinking about languages recently, and I'm wondering what the most simple Turing complete language needs. By this I mean flow control (if/else) and recursion or loops (or the beloved Y combinator). What would be a list of these features?
- valarauca1 13y agoThe mov operator in x86 assembly is technically Turning Complete onto itself [1]. I believe you'd be hard pressed to get smaller then that. [1] http://www.cl.cam.ac.uk/~sd601/papers/mov.pdf http://www.cl.cam.ac.uk/~sd601/papers/mov.pdf
- sethhovestol 13y agoI'm impressed. What I'm thinking more of is what types of functions and specific functions do you need? So also add, subtract...
- ggchappell 13y agoAll you need is mov (and, technically, a single unconditional branch in each program). You can implement add, subtract, etc. using that. Perhaps the question you want an answer to is not actually the one you asked? In any case, a programming language does not have to look like ALGOL. Most of the very simple ones do not.
- bmm6o 13y agoNothing about Turing completeness requires the presence of functions. You're probably looking for a useful language, but you'll have trouble making that criterion rigorous.
- ggchappell 13y agoA fair amount of research has gone into this question. A number of very simple Turing-complete languages are known. valarautical mentioned x86 mov. Another is an assembly-ish language with two instructions: (1) decrement and (2) branch if <= 0. Another is the Lambda Calculus. The only thing it has is lambda (and variables and function application, if you want to consider those to be things). Lisp with only QUOTE, ATOM, EQ, CAR, CDR, CONS, and COND is another example (and perhaps even that list is not minimal; I'm a little vague on this).
- sethhovestol 13y agoThe lisp example is actually exactly what I'm looking for!
- tsuyoshi 13y agoThis type of language is called a Turing Tarpit: http://esolangs.org/wiki/Turing_tarpit http://esolangs.org/wiki/Turing_tarpit
- gus_massa 13y agoWhy the SKI “programming” language is not included in the list of examples? http://en.wikipedia.org/wiki/SKI_combinator_calculus http://en.wikipedia.org/wiki/SKI_combinator_calculus
- deleted 13y ago[deleted]
- dbieber 13y agoAre you familiar with Brainfuck? http://en.wikipedia.org/wiki/Brainfuck http://en.wikipedia.org/wiki/Brainfuck It has just 8 symbols and looks like gibberish when you actually write it. I think you'll find it to be an amusing example of a very small Turing complete language.