Create Programming Language from Scratch
When processors and microcontrollers were newly invented, programmers have to write their program in 1 and 0. You do one mistake and you have to punch the whole card again. This was very frustrating and confusing plus a lot of hard work was required so they come up with a general solution. So, let’s get started.
Firstly, to create your own programming language, you gotta have knowledge of C, C++. You must know how things work and how a computer understands it. Plus another thing that you have to keep in mind is what your Programming language will do. Whether it will be used in web development or Android application. Many developers are fascinated by this keyword “create programming language from scratch“.
1. Compiler & Interpreter
Every Programming language has its own compiler or interpreter, which understands the command and executes them. Also, has its own unique compiler. you cannot run Java on C compiler. Thus the first step will be to create a compiler that understands your language and it can be made in different programming languages like C, python but the best will be C. To learn more there are several books like “Compiler design in C“, “Engineering a Compiler“, “Flex and Bison“.
WhatIs.com Definition: A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or “code” that a computer’s processor uses and an interpreted program, sometimes called a script, is a program whose instructions are actually a logically sequenced series of operating system commands, handled one at a time by a command interpreter .
2. Add-ons required!
Though every programming language follows a particular pattern of rule for defining a variable or printing the result. If you have any better ideas that could ease the problem you can design it by any means. All you have to remember is that there should be no error or uncertain display of output.
If you don’t have any new idea. Here are some rules that your language should have:
- Printing: One of the basic & most useful things, to print output on the screen.
- Data Types: It should support some simple data types like integers, float, and strings.
- Comments: Every professional prefers comments whenever required and it is a very useful tactic.
- Declaring variable: Take value from the user and it needs to be stored somewhere.
- Conditional statements: If else statements to differentiate between values and variable.
- Looping: If you have to do something thousand times you won’t write the code thousand time, you just create a loop like while loop or a for loop.
- Functions: If one wants to use a certain code again and again in different places. You don’t need to write that again. So you define it once and calls it wherever required.
These were some basic features that a programming language should have and if you are going with object-oriented. Here are some more rules for object-oriented programming (OOP). OOP is more preferred now a days.
- Overriding functions
Just remember one thing you must have a definite purpose in your mind. Which means you should know what your programming language will do. And also you have to understand how other compilers work for that platform. The goal is to ease the complexity as much as possible with more features. Also, this was some basic features if you want you can add something new.
Also if you don’t want to create any language but want to contribute. There are many languages which are open source like Microsoft Bosque. It’s not easy to make any programming languages but also not impossible. You just need to have the right knowledge. Here are some of the best resources available online. Tell us in comments if want a dedicated post for top-notch resources & books based on this topic.