7.2 PROGRAMMING LANGUAGES

7.2 প্ৰগ্ৰামিং ভাষা

In order to communicate in a structured manner, we the human beings use languages. Similarly, to communicate with computers, we should have some languages. These languages are called programming languages. A program is a set of instructions to perform some tasks by the computer. The languages that are used to write a program are called programming languages.

সংগঠিত ভাৱে যোগাযোগ কৰিবলৈ, আমি মানুহে ভাষা ব্যৱহাৰ কৰোঁ। একেদৰে, কম্পিউটাৰৰ সৈতে যোগাযোগ কৰিবলৈ, আমাৰ কিছুমান ভাষা থাকিব লাগে। এই ভাষাবোৰক প্ৰগ্ৰামিং ভাষা বুলি কোৱা হয়। প্ৰ’গ্ৰাম হৈছে কম্পিউটাৰৰ দ্বাৰা কিছুমান কাম সম্পাদন কৰাৰ নিৰ্দেশনাৰ এক সংহতি। প্ৰ’গ্ৰাম এটা লিখিবলৈ ব্যৱহাৰ কৰা ভাষাবোৰক প্ৰগ্ৰামিং ভাষা বুলি কোৱা হয়।

Programming languages are similar to humani languages in the sense that they have well-defined rules and regulations, called the grammar or the syntax of the language. All the instructions written in the program must follow the syntax of the language. Programming languages can broadly be categorized in three types.

প্ৰ’গ্ৰামিং ভাষাবোৰ মানৱীয় ভাষাৰ সৈতে একে এই অৰ্থত যে সেইবোৰৰ সুনিৰ্ধাৰিত নিয়ম আৰু নিয়ম আছে, যাক ভাষাৰ ব্যাকৰণ বা বাক্যবিন্যাস বুলি কোৱা হয়। প্ৰ’গ্ৰামটোত লিখা সকলো নিৰ্দেশনা ভাষাৰ বাক্যবিন্যাস অনুসৰণ কৰিব লাগিব। প্ৰ’গ্ৰামিং ভাষাবোৰ বহলভাৱে তিনি প্ৰকাৰত শ্ৰেণীবদ্ধ কৰিব পাৰি।

1. Machine level language

যন্ত্ৰ স্তৰৰ ভাষা

 2. Assembly level language

 2. সমাবেশ পৰ্যায়ৰ ভাষা

3. High-level language

উচ্চ-স্তৰৰ ভাষা

CPU communicates in machine level languages and these languages use only binary numbers (0 and 1). All the instructions are written using Os and 1s. A program written in machine level language will be only combinations of Os and 1s as shown in Figure 7.1.

চিপিইউয়ে যন্ত্ৰ স্তৰৰ ভাষাত যোগাযোগ কৰে আৰু এই ভাষাবোৰত কেৱল বাইনাৰী সংখ্যা (0 আৰু 1) ব্যৱহাৰ কৰা হয়। সকলো নিৰ্দেশনা অ’ আৰু 1 ব্যৱহাৰ কৰি লিখা হয়। যন্ত্ৰ স্তৰৰ ভাষাত লিখা প্ৰ’গ্ৰাম এটা কেৱল চিত্ৰ 7.1-ত দেখুওৱাৰ দৰে অ’ আৰু 1-ৰ সংমিশ্ৰণ হ’ব।

Now, you must have realized that to communicate with the machine, we are to write everything using Os and Is and this is a nightmare for every human being. Even computer scientists need to put huge efforts to write a program.

এতিয়া, আপুনি নিশ্চয় উপলব্ধি কৰিছে যে যন্ত্ৰটোৰ সৈতে যোগাযোগ কৰিবলৈ, আমি অ’এছ এণ্ড আই এছ ব্যৱহাৰ কৰি সকলো লিখিব লাগিব আৰু এইটো প্ৰতিজন মানুহৰ বাবে এক দুঃস্বপ্ন। আনকি কম্পিউটাৰ বিজ্ঞানীসকলেও এটা প্ৰ’গ্ৰাম লিখিবলৈ বৃহৎ প্ৰচেষ্টা কৰিব লাগিব।

The next level of languages are assembly languages. In these types of languages, instead of writing the program in binary format, we write them using some English words and symbols.

পৰৱৰ্তী স্তৰৰ ভাষাবোৰ হৈছে সমাবেশৰ ভাষা। এই প্ৰকাৰৰ ভাষাবোৰত, প্ৰ’গ্ৰামটো বাইনাৰী ফৰ্মেটত লিখাৰ সলনি, আমি সেইবোৰ কিছুমান ইংৰাজী শব্দ আৰু চিহ্ন ব্যৱহাৰ কৰি লিখিম।

An example of an assembly language program is shown in Figure 7.2. You can see that the program looks much better than the previous one. It is easy to read, understand and write.

চিত্ৰ 7.2-ত এচেম্বলী ভাষা প্ৰ’গ্ৰামএটাৰ উদাহৰণ দেখুওৱা হৈছে। আপুনি দেখিব পাৰে যে প্ৰ’গ্ৰামটো আগৰপ্ৰ’গ্ৰামটোতকৈ বহুত ভাল দেখায়। পঢ়িবলৈ, বুজিবলৈ আৰু লিখিবলৈ সহজ।

To write a program in assembly language for a CPU, we should know the ISA of the CPU including the register names. For example, the program in Figure 7.2 used registers $v0, $a0, $10, and $t1. This brings some complicacy for the programmers.

চিপিইউ এটাৰ বাবে এচেম্বলী ভাষাত এটা প্ৰ’গ্ৰাম লিখিবলৈ, আমি পঞ্জীৰ নামসহ চিপিইউৰ আইএছএ জনা উচিত। উদাহৰণ স্বৰূপে, চিত্ৰ 7.2-ৰ প্ৰ’গ্ৰামটোৱে $v 0, $a 0, $10 আৰু $t 1 ৰেজিষ্টাৰ ব্যৱহাৰ কৰিছিল। এইটোৱে প্ৰগ্ৰামাৰসকলৰ বাবে কিছু অনুপালন আনিছে।

Now look at the program as shown in Figure 7.3. This looks even better than the assembly language program. We can define and use variables from our side (we will learn this in the next chapter). This kind of programming gives flexibility to the programmer. We call it high level language (HLL) programming.

এতিয়া চিত্ৰ 7.3-ত দেখুওৱাৰ দৰে প্ৰ’গ্ৰামটো চাওক। এইটো এচেম্বলী ভাষা কাৰ্যসূচীতকৈও ভাল দেখায়। আমি আমাৰ ফালৰ পৰা চলকবোৰ নিৰ্ধাৰণ আৰু ব্যৱহাৰ কৰিব পাৰোঁ (আমি পৰৱৰ্তী অধ্যায়ত এইটো শিকিম)। এই ধৰণৰ প্ৰগ্ৰামিংয়ে প্ৰগ্ৰামাৰজনক নমনীয়তা প্ৰদান কৰে। আমি ইয়াক উচ্চ স্তৰৰ ভাষা (এইচএলএল) প্ৰ’গ্ৰামিং বুলি কওঁ।

A program written in HLL is the closest to the human languages. To write a program in HLL, we do not need to know the details of the processor where the program runs. Thus we always prefer to write programs in HLL.

এইচএলএল-ত লিখা এটা কাৰ্যসূচী হৈছে মানৱ ভাষাৰ আটাইতকৈ নিকটতম। এইচএলএল-ত প্ৰ’গ্ৰাম এটা লিখিবলৈ, আমি প্ৰ’গ্ৰামটো ক’ত চলে প্ৰচেছৰৰ বিৱৰণ জানিব নালাগে। এনেদৰে আমি সদায়এইচএলএলত প্ৰ’গ্ৰাম লিখিবলৈ পছন্দ কৰোঁ।

From the above discussion, we understood that computers understand and operate on machine language and the programmer prefers to code in HLL. When a program is written in any HLL, to execute it on a computer, it needs to be converted into an equivalent machine language program. This is called compilation of a program.

ওপৰোক্ত আলোচনাৰ পৰা, আমি বুজি পাইছিলো যে কম্পিউটাৰবোৰে যন্ত্ৰৰ ভাষা বুজি পায় আৰু পৰিচালনা কৰে আৰু প্ৰগ্ৰামাৰে এইচএলএল-ত কোড কৰিবলৈ পছন্দ কৰে। যেতিয়া প্ৰ’গ্ৰাম এটা যিকোনো এইচএলএল-ত লিখা হয়, ইয়াক কম্পিউটাৰত সম্পাদন কৰিবলৈ, ইয়াক এক সমতুল্য যন্ত্ৰ ভাষা প্ৰ’গ্ৰামলৈ ৰূপান্তৰ কৰিব লাগিব। ইয়াক প্ৰ’গ্ৰাম এটাৰ সংকলন বুলি কোৱা হয়।

The basic job of a compiler is to convert a program written in high level language to the machine level language of the computer where the program runs. While doing so, it does a series of jobs in between.

কম্পাইলাৰ এটাৰ মৌলিক কাম হৈছে উচ্চ স্তৰৰ ভাষাত লিখা প্ৰ’গ্ৰাম এটাক কম্পিউটাৰৰ যন্ত্ৰ স্তৰৰ ভাষালৈ ৰূপান্তৰ কৰা য’ত প্ৰ’গ্ৰামটো চলে। এনে কৰোতে, ই মাজত কেইবাটাও কাম কৰে।

Some important jobs of a compiler are: syntax analysis (checks whether the program is written following the rules of the language or not), intermediate code generation (converts the HLL program into an intermediate form), optimization (improves the efficiency of the program), etc. We will learn the compilation process in the context of a C program in the next chapter.

কম্পাইলাৰৰ কিছুমান গুৰুত্বপূৰ্ণ কাম হৈছে: বাক্যবিন্যাস বিশ্লেষণ (ভাষাৰ নিয়ম অনুসৰণ কৰি প্ৰ’গ্ৰামটো লিখা হৈছে নে নাই পৰীক্ষা), মধ্যৱৰ্তী কোড প্ৰজন্ম (এইচএলএল প্ৰ’গ্ৰামক মধ্যৱৰ্তী ৰূপলৈ ৰূপান্তৰ কৰে), অপ্টিমাইজেচন (কাৰ্যসূচীটোৰ দক্ষতা উন্নত কৰে), ইত্যাদি। আমি পৰৱৰ্তী অধ্যায়ত এটা চি প্ৰ’গ্ৰামৰ পৰিপ্ৰেক্ষিতত সংকলন প্ৰক্ৰিয়াটো শিকিম।