Menu Close

How to Create Your Own Programming Language from Scratch!

January 30, 2015 by admin ·

So I’ve been recently expanding my skills as a programmer and one of the things I’m most excited about learning is how to create a programming language from scratch! Doesn’t it sound crazy and extremely hard? Maybe even impossible? I thought so too until my friend showed me the right resources to learn from (which I will tell you about later too), and while I won’t say it’s been a cinch, it has been a lot of fun and personally satisfying!

Why Do It?

You may be asking, why would I be interesting in doing something like this? I suppose it’s for the challenge of the thing. I take on lots of do it yourself projects around my house that I could simply hire out. I like knowing that I was able to overcome an obstacle with my own wits, and it reminds me that I can forge my own path in life.

It also keeps my mind sharp. Studies show that people who learn new skills and solve new puzzles on a regular basis have less of a risk for Alzheimer’s in their old age. Since I plan to live to be 120 (no, really, I do!) I need to keep my mind in shape, and creating my own programming language helped keep my brain healthy.

I also am able to do more as a computer programmer with my own language. It’s a marketable skill that I can now offer, and it directly affects my wallet and monetary bottom line. With the new language I’ve written, I’m also able to do certain programming tasks more easily because I customized it to the type of work I do.

Just know – you’ve got some years of work in front of you if you choose to do this. It’s fairly thankless work, and if you are planning to market and sell it and make a name for yourself in the future, you’ve got to keep the end consumers in mind as you go. Having the ability to test out your language on others is invaluable, so you may consider having a team to help you get this done.

So, hopefully I’ve convinced you by now that writing a programming language is a good idea! Now…how is it done?

Steps to Create a Programming Language

The first thing you’ll need is a good working knowledge of a source language. Good ones to start with include C++, C#, Java, or Python. You will write the definitions for your new language in one of these high level languages. This is known as a compiler, and essentially what you will do is write awkward definitions for what you want to do, then craft a brand new format for those functions that makes sense and is more readable based on the work you want to do.

For instance, if you have to quickly calculate a series of complex calculations with many inputs over and over again throughout your work day, what you would consider doing is writing out the calculations in C++, then defining a new way to execute that function where the inputs are simpler to use. Doing things this way, you are more efficient in your work because the language is custom written to do your calculation.

Really this is all just the beginning – what you ought to do is check out the awesome book How to Create Your Own Freaking Awesome Programming Language. I was struggling to get my language implemented correctly for a long time until I ran across this book in a Google search.

For a minimal fee I really, finally got my language kickstarted. Initially set out in this post to hash through many of the details of creating a language but then I figured – hey – I’ll just lead them to the same place that I learned from. Don’t believe me? Check out these reviews from established authorities:

“[It] covers the broad concepts well with a focus on quick results…” – Peter Cooper, RubyInside.com

“I’m just going to say, I totally recommend this ebook, I enjoyed it, and it probably even made me a little better as a programmer. Definitely recommend you buy it.” – Giles Bowkett

Ready to take the plunge? Check it out here!