When I was in my middle school, I never really understood why we would learn programming languages. We had LOGO (Language of Graphics Oriented), BASIC (Beginners All-purpose Symbolic Instruction Code), C, and C++ languages in our curriculum with each passing year. And I was just cramming whatever was just taught without bothering in trying something new as we do to solve a puzzle.
When I started graduation I finally realized that such kinds of computer languages actually help us build fascinating applications. Even operating systems like Windows (whose fondness grew with time due to its colorful graphics) was itself written in C, C++, and C# depending on the versions. At that time, other than C and C++, we also had Core Java, Visual Basic in our course’s syllabus.
Our project works were very elemental, and were just confined to hospital/library/automobile management, and so forth. Those who weren’t serious about their studies would simply manage to take already built projects from elsewhere without doing anything practically. Anyway the point is, we were so delusional that even a few successful programming at the time would lead us to think about our future very brightly.
As I grew older, the world was gravitating towards everything online, and hence, the programming languages needed to shift to powerful frameworks such as .NET (using VB, C#, MVC, etc.); servers, Big Data et cetera. At that time, I began to think about it more deeply.
Languages like Visual Basic (or Visual C++) was built to make life easier and faster for programmers so that the projects were delivered on time. One didn’t have to literally put all efforts to become expert in C with Graphics, since VB/VC++ would provide already created tools to be dragged and dropped.
It is no rocket science to understand that expert developers really worked hard on creating graphical tools, so that the coding related to working could be implemented and time isn’t wasted just to draw things. It would otherwise have taken ages to deliver if done from the scratch.
But, what about C itself? How did they create the core languages before moving on to the advanced ones? How to make computers function in that manner, to work in that exact way as expected?
Most of us are just clients or users or programmers who straightforwardly want to implement whatever the technology has to offer. Only a handful of folks would want to turn to different paths, and that too, when they find something very important that’s missing.
If someone is assigned real-time projects, they may feel that certain sets of code need not to be written repeatedly. This is the reason why functions, modules, and classes were introduced in computer languages in the first place. Yet it is still likely that limitations exist which would enable someone to fix. So, let’s begin with the starting point.
In order to understand all of this, one needs to get to know about the core concepts first before beginning to get the idea behind how things work inside of a system.
At the very beginning, the programmers would write codes only in 0 and 1. This was considered as machine language. It was quite evident that, that was too difficult and could only be done by intellectuals. If something wrong happens, it had to be checked right from the beginning which was time consuming. The method also had punch cards to work on, not the regular keyboard we use today. The punch card was punched manually to store information. The same card was also inserted in order to be read later.
It would contain information something like below:
Suppose one wants to write “hi”. The ASCII codes of the letters “h” and “i” are – 104 and 105 – respectively. Furthermore, the binary equivalent of these numbers are 01101000 and 01101001. Let’s not go into the details how to convert decimal to binary or vise versa as of now, though it is possible to do the calculation manually. Anyway, as we know that the system understands only the binary, you can understand that it stores 01101000 and 01101001 instead of alphabets hi. Each line of code would have 1 punch card. The list of disadvantages of machine language is long and obvious. Following are the disadvantages of machine language and punch cards that are included but not limited:
- It was time consuming. If the data was incorrect then more time was spent to resolve that.
- It needed highly skilled individuals to write codes to avoid mistakes.
- It had very less space to store data. Just one line of code would require one punch card.
Few developers came up with an idea of introducing assembly language which was comparatively easier than the machine language. It looked something like this:
Assembly language would use assembler (similar to compiler) whose job was to change the assembly language into computer-readable machine code. Assembly language is still not outdated and is used to write programs for direct hardware manipulation, in embedded/red-time systems, etc.
How to create a programming language?
A lot of things need to be kept in mind theoretically before jumping to the practical part right from the beginning. First, understand the need to create one – whether it is part of your academics’ thesis or just a general curiosity. For the sake of eagerness, one can read information from reliable sources. In case of the real-time work, they need to first learn the in-depth of how things work, the brief of which is discussed already. Next, clarify your mind and assess your language with the following questions:
1. Know the technology: You should be familiar with the existing technology. A lot of powerful programming languages are already built to remedy issues which were before. So, you need to know the kinds of logic you think need to be implemented but those might already be there.
Also decide what kind of problem you intend to solve. Is it domain-specific language or for general purpose? If it is domain-specific, how is it going to interface with existing libraries and languages like C?
2. Choose one between compiler or interpreter: Decide whether your language will use compiler to translate (your) (high-level language) code instructions into machine language in one go OR by taking a single line at a time, OR BOTH. Do remember that it requires coding as well in order to supervise the system what should be shown when, or when to run/execute if no error/warnings are there. Also think about the debugging steps.
3. Decide semantics: Will your language have direct pointer access? What data types you would like to include? Are you planning to use garbage collector or manual memory management? What will be the paradigm(s) of your language – functional, object-oriented, template-oriented, aspect-oriented, prototype, or anything new?
4. Work with grammar: By the term “grammar” in this context, it refers to working with deciding the syntax of everything. This includes the correct spelling of data and functions and using them correctly.
Following is the glimpse of that:
“a” .. “z”
“0” .. “9”
“let” identifier “(” Parameters “)” “:” Expression
identifier “,” Parameters
“if” Expression “then” Expression “else” Expression
Expression (“=” | “<>” | “<=” | “>=” | “<” | “>”) Expression
Expression (“+” | “-” | “*” | “/”) Expression
Expression “(” Arguments “)”
Expression “,” Arguments
The above statements define what letters, numbers, boolean, digits, and identifiers are. It also shows the methods in which one should use functions and conditional statements.
Your language’s compiler/interpreter should be able to detect the error if it does not follow the preset norms. It should also be able to pinpoint where the mistakes are.
Last but not the least, always document what you do. Documentation is like a record keeper that: 1.) Lets other programmers know what was being done, and 2.) To never let you forget what you executed before to enable everything work.
If you are unfamiliar with the programming language then I wouldn’t recommend you to go for it because it would take you lots of months to first become an expert and then years to learn the base of everything; simply read related books instead.
If you are actually a code geek, you probably know what’s to be done. The latter kinds of folks do not wait but begin their work due to extreme curiosity. So, happy programming!!
NDZ is a PCI Level 1 certified company that is headquartered in India’s one of the major IT hubs. Having a wide range of IT solutions to clients’ needs we have reached to the mark of immense success and continue to strive for betterment.
There are no revisions for this post.