Programming languages - Instructions

January 2017

What does an instruction look like?

The instruction is the key element in the computer as it tells the processor which action should be performed. The instructions which are to be executed are indicated in the source file and the computer goes from one instruction to the next following the instructions from top to bottom (as a file is read in sequence from top to bottom).
An instruction is generally comprised of two elements:

  • the operator: the action that the processor is to carry out
  • the operand(s): one or more pieces of data on which the operation is performed

operator operand(s)

Types of operators:

There are generally two or three types of operators:

  • Unary operators: those which operate on one operand only
  • Binary operators: these operators are those which, contrary to what you would think, do not work on binary operands, but rather work on two operands (binary here means the number of operands that are affected, addition, often denoted as +, is therefore a binary operator)
  • Ternary operators: are operators which allow three operands (for example, conditional operators are ternary operators)
Operators may also be divided into several categories according to the type of operation they perform when executed:
  • arithmetic operators
  • comparison operators
  • logical operators
  • bit operators
  • assignment operators
  • conditional operators
  • sequential operators
  • ...

Operator priority

Each language generally has operator precedence so that the computer knows in which direction to calculate the operators where several operators exist in the same expression

Related



Lenguajes de programación - Instrucciones
Lenguajes de programación - Instrucciones
Langages informatiques - Instructions
Langages informatiques - Instructions
Linguaggi informatici - Istruzioni
Linguaggi informatici - Istruzioni
Linguagens informáticas - Instruções
Linguagens informáticas - Instruções
Latest update on October 16, 2008 at 09:43 AM by Jeff.
This document, titled "Programming languages - Instructions," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (ccm.net).