A programming language is a formal computer language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs to control the behavior of a machine or to express algorithms.
Types Of Programming language:-There are Major three typees of languages.
1.Machine Level Language:-
It is the only language a computer can process directly without a previous transformation. Currently, programmers almost never write programs directly in machine code, because it requires attention to numerous details that a high-level language handles automatically. Furthermore it requires memorizing or looking up numerical codes for every instruction, and is extremely difficult to modify.True machine code is a stream of raw, usually binary, data. A programmer coding in "machine code" normally codes instructions and data in a more readable form such as decimal, octal, or hexadecimal which is translated to internal format by a program called a loader or toggled into the computer's memory from a front panel.
Although few programs are written in machine language, programmers often become adept at reading it through working with core dumps or debugging from the front panel.
Example: A function in hexadecimal representation of 32-bit x86 machine code to calculate the nth Fibonacci number:
8B542408 83FA0077 06B80000 0000C383
FA027706 B8010000 00C353BB 01000000
B9010000 008D0419 83FA0376 078BD989
C14AEBF1 5BC3
Low Level Language:-
Second-generation languages provide one abstraction level on top of the machine code. In the early days of coding on computers like the TX-0 and PDP-1, the first thing MIT hackers did was write assemblers.Assembly language has little semantics or formal specification, being only a mapping of human-readable symbols, including symbolic addresses, to opcodes, addresses, numeric constants, strings and so on. Typically, one machine instruction is represented as one line of assembly code. Assemblers produce object files that can link with other object files or be loaded on their own.Most assemblers provide macros to generate common sequences of instructions.
Example: The same Fibonacci number calculator as above, but in x86 assembly language using MASM syntax:
High Level Language:-It is the human understandable language.
A high-level language is a programming language
such as C, FORTRAN, or Pascal that enables a programmer to write
programs that are more or less independent of a particular type of
computer. Such languages are considered high-level because they are closer to human languages and further from machine languages,And a microprocessor cannot directly execute a program written in HLL so we need to convert it into Machine code
As we know HLL is the smartest and convenient to understand so study that only.And to execute that we need a software named as translator.
A translator is a computer program that performs the translation of a program written in a given programming language into a functionally equivalent program in a different computer language, without losing the functional or logical structure of the original code (the "essence" of each program).
These are of three types.
1.Assembler:-An assembler program creates object code by translating combinations of mnemonics and syntax for operations and addressing modes into their numerical equivalents. This representation typically includes an operation code ("opcode") as well as other control bits and data. The assembler also calculates constant expressions and resolves symbolic names for memory locations and other entities.
2.Compiler :-A compiler is a computer program (or a set of programs) that transforms source code written in a programming language (the source language) into another computer language (the target language), with the latter often having a binary form known as object code.
Interpreter:- an interpreter is a computer program that directly executes, i.e. performs, instructions written in a programming or scripting language, without previously compiling them into a machine language program.An Interpreter executes a program or script line by line i.e one line at a time.
Letter C
It is a general-purpose, imperative computer programming language, supporting structured programming, lexical variable scope and recursion, while a static type system prevents many unintended operations. By design, C provides constructs that map efficiently to typical machine instructions, and therefore it has found lasting use in applications that had formerly been coded in assembly language, including operating systems, as well as various application software for computers ranging from supercomputers to embedded systems. C was originally developed by Dennis Ritchie between 1969 and 1973 at Bell Labs, and used to re-implement the Unix operating system. It has since become one of the most widely used programming languages of all time,with C compilers from various vendors available for the majority of existing computer architectures and operating systems. C has been standardized by the American National Standards Institute (ANSI) since 1989 (see ANSI C) and subsequently by the International Organization for Standardization (ISO).
Taking an example to understand the working and functioning of every single individual which are used in program.
#include<stdio.h>
#include<conio.h>
int main()
{
printf("Welcome To The World Of C");
getch();
return 0; }
Out Put of The program:-
Deep analysis of the elements of the program.
Now it is
time to understand what a single do in a program:-
· #include:-This is a pre-processor command
which directs compiler to include specific header file or any other C file. It
is also known as file inclusion command.
· Header file:-It is a file which is also built in C contains Declaration of built in
functions such as printf();scanf();etc. C also allows its users to build their
own header file as per their requirements. Some of the most commonly used
header files are .1.stdio.h-Standard Input and Output.2.conio.h-Console Input and Output.
Main
Function:-[main()]It
is the primary function in any C program. Execution of the C program starts
from main().The main function controls the execution of the C program by
directing calls to the other functions in C program. The execution of a C
program usually starts from main ends with in main.
Some Unknown features Which comes to the action when a
program is executed:
·
Pre-processor:-It is a software which performs some
operation before compiling of a program such as including a header file, macro
expansion, Conditional execution.
·
Linker:-This is program which compile modules
and library to form executable code.
·
Loader:-It is an utility provided by operating
system to its users which loads program from secondary memory to primary memory
so that it can be executed.
No comments:
Post a Comment