What are practical guidelines for evaluating a language's “Turing Completeness”?

前端 未结 13 2305
礼貌的吻别
礼貌的吻别 2020-12-22 19:22

I\'ve read \"what-is-turing-complete\" and the wikipedia page, but I\'m less interested in a formal proof than in the practical implications of being Turing Complete.

<
13条回答
  •  没有蜡笔的小新
    2020-12-22 19:58

    Is there a minimum set of features without which Turing Completeness is impossible? Is there a set of features which virtually guarantees completeness?

    Yes, you need to have flow of control conditional on data: what is often expressed as if. For example a +-*/ pocket calculator is not Turing-complete, since there is no way to express conditionals.

    You also need to be able to express a jump back to an earlier point in the program, on top of which you could implement a loop. For example BPF, which forbids backwards jumps to guarantee the program will terminate, is also not Turing complete.

    You need some storage that is both readable and writable and arbitrarily large. For example, a language that has only two 32-bit variables is limited in what it can compute. You have many options for how the storage is structured: memory addressed by pointers, arrays, stacks, cons cells, pure data structures, etc.

    On top of these you can build every other programming language: it may not be easy or fast, but it is enough.

提交回复
热议问题