HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Is it possible to use machine learning to interpret a programming language and guess it's output

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
interpretprogrammingandoutputlanguagelearningpossiblemachineuseguess

Problem

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 = 4 to 2 plus 2 equal four to Please add two and two.



  • Making a really horrible python interpreter would be funny.

Solution

I doubt it. That requires learning a pretty complex function, which seems beyond the reach of current machine learning techniques.

But there's probably no reason to use machine learning for this, as we already know how to program an interpreter, and that will be more effective than using machine learning.

Context

StackExchange Computer Science Q#70988, answer score: 4

Revisions (0)

No revisions yet.