I know machine learning can make some predictions. With enough input data and example output data a machine can accept an image as input and determine that the image is likely a "flower" (output).
Could the same method apply to an interpretive programming language? Let's say Python for example. The inputs on every "line" of python would be existing memory and the new "line" of syntax. So if x = 2 (some data in ram as say CPython would set it instead of the actual syntax). Our new line of syntax is
x + 2. The output is
4 (perhaps the updated ram state could also be considered an output). With enough sample input and output could a machine learning algorithm effectively "invent" it's own python interpreter? Perhaps our invented interpreter would determine there is a 98% chance that 2 + 2 results in 4.
A few people are asking why would anyone would want to do this. Curiosity mostly and certainly reading too much Godel, Escher, Bach. I think it's interesting because:
- Perhaps it would find novel optimizations. Computers already find new strategies in chess. Why not interpreters or compilers?
- The idea of a programming language interpreting syntax probabilistically, that doesn't even have to follow strict rules, is interesting. Can we go from
2 + 2 = 4to
2 plus 2 equal fourto
Please add two and two.
- Making a really horrible python interpreter would be funny.