What is a programming language?
- Programming Language is
- A tool for instructing machines.
- A means of communicating between programmers.
- A means of controlling computerized devices.
- A notation for algorithms.
- Scientific applications
- Business applications
- Artificial intelligence
- Systems programming
- Scripting languages
- Special purpose languages
- Machine language is the lowest-level programming language.
- Machine languages are the only languages understood by computers.
- A computer programming language consisting of binary or hexadecimal instructions which a computer can respond to directly.
Why Humans Don’t Use Machine Language
Machine languages are almost impossible for humans to use because they consist entirely of numbers.
Programmers, therefore, use either a high-level programming language or an assembly language.
An assembly language contains the same instructions as a machine language, but the instructions and variables have names instead of being just numbers.
Example of Machine language
•A low-level symbolic code converted by an assembler.
•Assembly language is converted into executable machine code by a utility program referred to as an assembler like NASM, MASM, etc.
- A processor understands only machine language instructions, which are strings of 1’s and 0’s.
- However, machine language is too obscure and complex for
usingin software development. So, the low-level assembly language is designed for a specific family of processors that represents various instructions in symbolic code and a more understandable form.
Advantages of Assembly Language
- Having an understanding of assembly language makes one aware of −
•How programs interface with OS, processor, and BIOS;
•How data is represented in memory and other external devices;
•How the processor accesses and executes
•How instructions access and process data; •How a program accesses external devices.
2. The symbolic programming of Assembly Language is easier to understand and saves a lot of time and effort of the programmer.
3.It is easier to correct errors and modify program instructions.
4. Assembly Language has the same efficiency of execution as the machine level language. Because this is one-to-one translator between assembly language program and its corresponding machine language program.
Disadvantages of assembly language
•Mnemonics in assembly language are in abbreviated form and in large number, so they are hard to remember.
•Program written in assembly language
•A program written in assembly language is less efficient to
•Mnemonics can be different for different machines according to manufacturers so assembly language suffers from the defect of non-standardization
Assembly is called a low-level programming language because there is (nearly) a one-to-one relationship between what it tells the computer to do, and what the computer does. In general, one line of an assembly program contains a maximum of one instruction for the computer.
An Assembly program to read in two decimal inputs and print out their sum, in decimal
NUM2 DB ?
NUM1 DB ?
RESULT DB ?
MSG1 DB 10,13,”ENTER FIRST NUMBER TO ADD : $“
MSG2 DB 10,13,”ENTER SECOND NUMBER TO ADD : $“
MSG3 DB 10,13,”RESULT OF ADDITION IS : $”
In Assembly programming, the variable are all defined by bytes only.
DB – Define Byte (Size – 1 Byte)
DW – Define Word (Size – 2 Byte)
DD – Define Double word (Size – 4 Bytes)
DQ – Define Quad word (Size – 8 Bytes)
DT – Define Ten Bytes (Size – 10 Bytes)
High Level 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.
Advantages of high-level languages
•Better portability (program runs on many CPUs)
•Richer data types and memory management
•Natural structures for expressing flow of control
•Much better support for software maintenance
•Much better support for software reuse
Translation Process of HLL
•Compiler: Translates an entire high-level language program into machine code before it is executed.
•Interpreter: Simulates a high-level language program, translating commands to machine code along the way, only as needed. Programming language like Python, Ruby use interpreters.
Features of C language
•It is a robust language with
•The C compiler combines the capabilities of an assembly language with features of a high-level language.
•Programs Written in C are efficient and fast. This is due to its variety of data type and powerful operators.
•C is highly portable this means that programs once
•Another important feature of
C – Program Structure
A C program basically consists of the following parts − •Preprocessor Commands •Functions •Variables •Statements & Expressions •Comments
printf(“me love programming\n”);
printf(“You will love it too once ”);
printf(“you no the trick\n”);