What is computer program?
A program is a set of instructions that tell a computer how to do a task. When a computer follows the
instructions in a program, we say it executes the program
What is programming language?
A set of rules, symbols, and special words used to produce various kinds of output.
Levels of programming languages
Programming languages are described in levels Low level programming is close to machine code,
high level programming is closer to natural languages. At the most basic level (or "lowest level") is
assembly language. This language is just a direct translation of the binary instructions the computer
executes each assembly language instruction directly relates to one in machine code Thus just as
every kind of processor architecture has its own machine code, each processor architecture also has
its own assembly language
Here's how to add two numbers in MIPS assembly:
High level languages look more like natural language with mathematical operations thrown in These
languages require more translation before the computer will understand them, but they are much
easier to write.
LUI R1, #1
LUI R2, #2
DADD R3, R1, R2
Here's what the same program might look like in a high level language:
Int R1, R2, R3;
R1=1;
R2=2;
R3 = R1 + R2;
The variation between different programming languages can be quite extensive Traditionally, the first
program a programmer writes in a new language is Hello World a simple program that outputs the
phrase “Hello World!" (or a variation thereof) to the user As will be clear from the following examples,
even this seemingly simple task can be expressed in many different ways depending on which
language is being used
For example: