Looking for languages that are not Turing complete

前端 未结 2 1100
小鲜肉
小鲜肉 2021-02-15 17:02

I know a little about what is a turing-machine and a turing-complete language, but to understand better, could someone give examples of languages that are not Turing complete? (

相关标签:
2条回答
  • 2021-02-15 17:28

    Regular languages - those that can be described as regular expressions - are not Turing complete.

    Markup languages (used for describing data, not computation) like XML and JSON are not Turing complete.

    0 讨论(0)
  • 2021-02-15 17:40

    Regular expressions, in the formal definition, consisting only of:

    • concatenation ( ab )
    • unbounded repetition ( a* )
    • alternation ( a|b )
    • grouping ( (ab)|(cd) )

    can only recognise regular languages. A Turing-complete programming language can recognise recursively-enumerable languages.

    An example is that regular expressions cannot tell you if a string consists of matched pairs of parentheses: eg ()(()) is accepted while ()((())() is rejected, while Turing-complete programming languages can.

    (Note that regexes in modern programming languages are more powerful than the formal academic definition of regular expressions. Some may even be Turing complete.)

    0 讨论(0)
提交回复
热议问题