I was wondering, is it possible to define an API and give it as an input to a TM turing machine and the output will be the code in c or any other natural/programming language?
I guess not but how do I show it formally by reduction etc. ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Your question seems to be asking if it is possible to write a program (in other words, a Turing Machine) that takes in a program specification (what you are calling an “API”) and outputs a program in some programming language. The answer to this is “of course”. Let’s look at a few examples.
Let’s say I write my input specification as a C program and I want to output a program in C. I call this Turing Machine program “copy” and I can trivially implement it in any language (or use the
cpcommand on the command line).Let’s say I write my input specification as a C program, and I want to output a program in assembly code. I call this Turing Machine program “compiler” and I can implement it in any language (or you can download a C compiler that already exists).
Let’s say I write my input specification in English and I want to output a program in C. I call this Turing Machine program “software engineer” and I implement it in the brain of a human by sending that human to school (or you can hire an existing software engineer).
The moral here is that a Turing Machine can do anything that a human can do (and a human can do anything a Turing Machine can do). But it’s really, really, really hard to write a computer program that is as general-purpose as a human.