A Shiny New Programming Language

Mirror is an entirely new concept in programming — just supply function signatures and some input-output examples, and AI does the rest.

Nick Bild
37 seconds agoMachine Learning & AI
Mirror is a programming language the generates code from input-output examples (📷: Austin Z. Henley)

Anyone with even a passing interest in machine learning understands how these algorithms learn to perform their intended function by example. This has proven to be a very powerful technique. It has made it possible to build algorithms that can reliably recognize complex objects in images, for example, which would be virtually impossible with standard rules-based programming techniques.

Austin Z. Henley of Carnegie Mellon University has been exploring the idea of using a set of examples when running inferences against a trained model as well. Specifically, Henley has been designing a proof of concept programming-by-example programming language that is powered by a large language model (LLM). The basic idea of this unique language, called Mirror, is that the programmer should just provide a few input-output examples for a function, then the LLM should write and execute the actual code behind the scenes.

To use Mirror, a user first defines the signature (name, input and output parameter data types) of a function. This is followed by one or more example calls of the function, with appropriate input and output parameters supplied. Functions are then called and chained together as needed to accomplish the programmer's goal.

On the backend, a traditional recursive descent parser makes a pass before the result is sent to an OpenAI LLM along with a prompt instructing it to generate JavaScript code to complete the functions with code that satisfies the constraints of the examples. The code is shown to the programmer, giving them the opportunity to provide more examples if things do not look quite right.

If you would like to take a crack at programming with Mirror for yourself, a browser-based playground has been made available in the GitHub repository. Just supply your own OpenAI API key, and you are good to go.

The concept behind Mirror is very interesting, and could ultimately lead to new and more efficient ways of working with computers in the future. But for now, it is in the very early stages and looks like something more appropriate for playing around with than much of anything else. Complex algorithms and enterprise-grade software are not likely to be produced by this type of method for some time to come.

Nick Bild
R&D, creativity, and building the next big thing you never knew you wanted are my specialties.
Latest articles
Sponsored articles
Related articles
Latest articles
Read more
Related articles