Introduction to Programming Language
A programming language is used to write a computer program which is also called computer software. The computer software is used to solve some specific problem or is used to facilitate a user.
Software is often divided into two categories:
- Systems software: Includes the operating system and all the utilities that enable the computer to function.
- Applications software: Includes programs that do real work for users. For example, word processors, spreadsheets, accounting systems, and database management systems fall under the category of applications software.
We use a programming language to write software. A programming language consists of a vocabulary and set of grammatical rules for instructing computer to perform some specific tasks. The term programming language usually refers to high-level languages, such as Java, C Sharp, Visual BASIC .NET, C, C++, COBOL, FORTRAN, Ada, and Pascal. Each language has a unique set of keywords (words that it understands) and a special syntax for organizing program instructions.
Computer programs (also software programs) are instructions for a computer. A computer requires programs to function, typically executing the program's instructions in a central processor (CPU). The program has an executable form that the computer can use directly to execute the instructions. The same program in its human-readable source code form, from which executable programs are derived (e.g., compiled), enables a programmer to study and develop its algorithms.
A programming language often consists of following elements:
- Data Members or Variables: Use to store information during the program execution.
- Arrays: Use to store multiple values of same data type.
- Conditional statements: Use to apply constraints in the program.
- Loops: A loop is a series of commands that will continue to repeat over and over again until a condition is met.
- Methods or Functions: Functions are used to perform some specific task.
- Classes: A class is an object-oriented concept which is used to describe properties and behavior of a real world entity. A class is used as a blueprint to create objects of that class.
- Object: An object is an instance of a class.
Source code of a computer program is often written by professional computer programmers.
Low Level Programming Languages
A programming language that is close to the binary machine code is also called assembly code. Assembly language is one step away from machine language. Each assembly language statement is translated into one machine instruction by the assembler. Programmers must be well versed in the computer's architecture, and, undocumented assembly language programs are difficult to maintain.
The problem with assembly language is that it requires a high level of technical knowledge, and it's slow to write. In the same time that you take to write ten lines of assembly language,, you could write ten lines of Java, perhaps the equivalent of 500 instructions!
A programming language that can be directly understood and obeyed by a machine (computer) without conversion (translation) is called machine language. Different for each type of CPU, it is the native binary language (comprised of only two characters: 0 and 1) of the computer and is difficult to be read and understood by humans. Programmers commonly use more English-like languages (called high level languages) such as Java, C Sharp, C, C++, etc., to write programs which are then translated into machine language (called a low level language) by an assembler, compiler, or interpreter.
High Level Programming Languages
In computing, a high-level programming language is a programming language with strong abstraction from the details of the computer. In comparison to low-level programming languages, it may use natural language elements, be easier to use, or be more portable across platforms. Such languages hide the details of CPU operations such as memory access models and management of scope.
This greater abstraction and hiding of details is generally mean to make the language user-friendly, as it includes concepts from the problem domain instead of those of the machine used. A high-level language separates the execution semantics of computer architecture from the specification of the program, making the process of developing a program simpler and more understandable with respect to a low-level language.
Stereotypically, high-level languages make complex programming simpler, while low-level languages tend to produce more efficient cod.
Java, C Sharp, Visual Basic .NET, C, C++ etc are high level languages.
Compiler
A compiler is a special type of computer program that translates a human readable text file into a form that the computer can more easily understand and execute. At its most basic level, a computer can only understand two things, 0 and 1.
A compiler is a special program that processes statements written in a specific programming language and transforms them into machine language or "object code" that a computer's processor (CPU) uses. Typically, a programmer writes language statements in a language such as C or Pascal one line at a time using an editor. The file that is created contains instructions which are called the source statements. The programmer then runs the appropriate language compiler, specifying the name of the file that contains the source statements.
When executing (running), the compiler first parses/ analyzes all of the language statements syntactically one after the other and then, in one or more successive stages or "passes", builds the output code, making sure that statements that refer to other statements are referred to correctly in the final code. Traditionally, the output of the compilation has been called object code or sometimes an object module. (The term "object" here is not related to object-oriented programming.) The object code is machine code that the processor can process or "execute" one instruction at a time.
So compiler definition is “In programming, a compiler takes human readable source code and converts it into the binary code that the computer can understand.”
Interpreter
Compiler and interpreter are software programs. Compiler and interpreter are both what we call translators. Their purpose is to translate programming language source code like (C++, VB, Java, assembly and so forth) in to a low level language(machine language) that are understood by the computer.
Compiler vs Interpreter
Compiler translates the entire source code at once which is executed later on. Compiler does not execute its input program (the source code) but translates it into executable machine code (also called object code) which is output to a file for later execution.
Interpreter translates and executes the entire source code one line at a time. Interpreting code is slower than running the compiled code because the interpreter must analyze each statement in the program each time it is executed and then perform the desired action whereas once a source code is compiled it just performs the action every time.
Assembler is a utility program used to translate assembly language statements into the target computer's machine code.
