Magic Compiler

Innovation in today’s technology is mostly around Artificial Intelligence (AI) and its sub topics such as Machine Learning (ML) and Natural Language Processing (NLP). There is a primary focus on NLP and ML among all the tech companies. This is for a good reason. Tech companies are using NLP and ML in various aspects of their offerings and trying to stay ahead of their respective competitors.

A Magic Compiler

With all of this going on, I feel like NLP & ML will greatly impact the future of programming and programming languages. It could be possible to create a programming language out of pure English (or any language for that matter) grammar. Alright, stay with me here for a second; the way it could work is:

  • The programmer would write what they want to achieve in EnglishStore user data such as name, age, sex, address and favorites in the database and create an endpoint that exposes this data securely
  • Using NLP, the compiler parses this information and creates or uses the existing User class and stores the user attributes such as name, age, sex, address and favorites
  • The compiler keeps correcting itself over the extended usage of the programming language using ML. The compiler figures out the datatype of the attribute. For ex: name is a String. age is an Integer. Since the attribute is named favorites, it figures that it’s a collection of Strings. Since the programmer instructed the compiler to expose an endpoint with the data securely, we get an https endpoint to access the resource.

The programmer can then do something like –
Every user has many photos. Store those photos in Amazon's S3 (maybe) bucket

A programming language like this could become a reality. Of course, this is a massive over-simplification of things, but, it could be possible. I mean, if human beings are capable of making computers perform intellectual tasks, this could totally be possible.

This can also be taken one step further and use speech to text conversion. Programmers can then just speak what they want to build and have the compiler write the code for them.

The advantage to creating something like this is extensibility. Imagine if every person who can speak a language can write code? Any person that can read/write a language, ends up being able to write plugins/extensions/modules in their language and contribute. There’s a lot of smart people out there and this programming model extends their creativity. Right now, it’s just a missed opportunity. It would be amazing to see what people do with their “newly acquired” skill.

Domain-specific languages (DSL)

Today, one can do something remotely similar by using Domain-specific languages (DSLs). But, DSLs are very restricted and don’t offer much in terms of flexibility in their usage. Hence, a proper implementation to support the above mentioned features would be required.

This would be a very interesting project to work on. I will continue research around this subject and see if I can come up with a trivial implementation of this.

Comments