Language primitive
Encyclopedia
In computing, language primitives are the simplest elements available in a programming language
. A primitive can be defined as the smallest 'unit of processing' available to a programmer of a particular machine, or can be an atomic element of an expression
in a language.
or string
of bytes from one memory
location to another or adding one processor register
to another.
s, however, actually embody an even lower unit of processing known as microcode
which interprets the "machine code" and it is then that the microcode instructions would be the genuine primitives. These instructions would typically be available for modification only by the hardware
vendors programmers.
(HLL) program is composed of discrete statements and primitive data types that may also be perceived to perform a single operation or represent a single data item, but at a more abstract level than those provided by the machine. Copying a data item from one location to another may actually involve many machine instructions that, for instance,
before finally
Some HLL
statements, particularly those involving loops, can generate thousands or even millions of primitives in a low level language
- which comprise the genuine instruction path length
the processor has to execute at the lowest level. This perception has been referred to as the "Abstraction penalty"
primitives but with a further added 'layer'. Before the statement can be executed in a manner very similar to a HLL
statement, first, it has to be processed by an interpreter, a process that may involve many primitives in the target machine language.
s and 5gl
s do not have a simple one-to-many correspondence from high-to-low level primitives. There are some elements of interpreted language primitives embodied in 4gl and 5gl
specifications but the approach to the original problem is less a procedural language construct and are more oriented toward problem solving
and systems engineering
.
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
. A primitive can be defined as the smallest 'unit of processing' available to a programmer of a particular machine, or can be an atomic element of an expression
Expression (programming)
An expression in a programming language is a combination of explicit values, constants, variables, operators, and functions that are interpreted according to the particular rules of precedence and of association for a particular programming language, which computes and then produces another value...
in a language.
Machine level primitives
A machine instruction, usually generated by an assembler program, is often considered the smallest unit of processing although this is not always the case. It typically performs what is perceived to be one single operation such as copying a byteByte
The byte is a unit of digital information in computing and telecommunications that most commonly consists of eight bits. Historically, a byte was the number of bits used to encode a single character of text in a computer and for this reason it is the basic addressable element in many computer...
or string
String (computer science)
In formal languages, which are used in mathematical logic and theoretical computer science, a string is a finite sequence of symbols that are chosen from a set or alphabet....
of bytes from one memory
Computer memory
In computing, memory refers to the physical devices used to store programs or data on a temporary or permanent basis for use in a computer or other digital electronic device. The term primary memory is used for the information in physical systems which are fast In computing, memory refers to the...
location to another or adding one processor register
Processor register
In computer architecture, a processor register is a small amount of storage available as part of a CPU or other digital processor. Such registers are addressed by mechanisms other than main memory and can be accessed more quickly...
to another.
Micro code primitives
Many of today's computerComputer
A computer is a programmable machine designed to sequentially and automatically carry out a sequence of arithmetic or logical operations. The particular sequence of operations can be changed readily, allowing the computer to solve more than one kind of problem...
s, however, actually embody an even lower unit of processing known as microcode
Microcode
Microcode is a layer of hardware-level instructions and/or data structures involved in the implementation of higher level machine code instructions in many computers and other processors; it resides in special high-speed memory and translates machine instructions into sequences of detailed...
which interprets the "machine code" and it is then that the microcode instructions would be the genuine primitives. These instructions would typically be available for modification only by the hardware
Computer hardware
Personal computer hardware are component devices which are typically installed into or peripheral to a computer case to create a personal computer upon which system software is installed including a firmware interface such as a BIOS and an operating system which supports application software that...
vendors programmers.
High level language primitives
A high-level programming languageHigh-level programming language
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 from the specification of the program, making the process of...
(HLL) program is composed of discrete statements and primitive data types that may also be perceived to perform a single operation or represent a single data item, but at a more abstract level than those provided by the machine. Copying a data item from one location to another may actually involve many machine instructions that, for instance,
- calculate the address of both operandOperandIn mathematics, an operand is the object of a mathematical operation, a quantity on which an operation is performed.-Example :The following arithmetic expression shows an example of operators and operands:3 + 6 = 9\;...
s in memoryComputer memoryIn computing, memory refers to the physical devices used to store programs or data on a temporary or permanent basis for use in a computer or other digital electronic device. The term primary memory is used for the information in physical systems which are fast In computing, memory refers to the...
, based on their positions within a data structureData structureIn computer science, a data structure is a particular way of storing and organizing data in a computer so that it can be used efficiently.Different kinds of data structures are suited to different kinds of applications, and some are highly specialized to specific tasks...
, - convert from one data typeData typeIn computer programming, a data type is a classification identifying one of various types of data, such as floating-point, integer, or Boolean, that determines the possible values for that type; the operations that can be done on values of that type; the meaning of the data; and the way values of...
to another
before finally
- performing the final store operation to the target destination.
Some HLL
High-level programming language
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 from the specification of the program, making the process of...
statements, particularly those involving loops, can generate thousands or even millions of primitives in a low level language
Low-level programming language
In computer science, a low-level programming language is a programming language that provides little or no abstraction from a computer's instruction set architecture. Generally this refers to either machine code or assembly language...
- which comprise the genuine instruction path length
Instruction path length
In computer performance, the instruction path length is the number of machine code instructions required to execute a section of a computer program. The total path length for the entire program could be deemed a measure of the algorithm's performance on a particular computer hardware...
the processor has to execute at the lowest level. This perception has been referred to as the "Abstraction penalty"
Interpreted language primitives
An interpreted language statement has similarities to the HLLHigh-level programming language
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 from the specification of the program, making the process of...
primitives but with a further added 'layer'. Before the statement can be executed in a manner very similar to a HLL
High-level programming language
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 from the specification of the program, making the process of...
statement, first, it has to be processed by an interpreter, a process that may involve many primitives in the target machine language.
Fourth and Fifth-generation programming language primitives
4glFourth-generation programming language
A fourth-generation programming language is a programming language or programming environment designed with a specific purpose in mind, such as the development of commercial business software. In the history of computer science, the 4GL followed the 3GL in an upward trend toward higher...
s and 5gl
Fifth-generation programming language
A fifth-generation programming language is a programming language based around solving problems using constraints given to the program, rather than using an algorithm written by a programmer...
s do not have a simple one-to-many correspondence from high-to-low level primitives. There are some elements of interpreted language primitives embodied in 4gl and 5gl
Fifth-generation programming language
A fifth-generation programming language is a programming language based around solving problems using constraints given to the program, rather than using an algorithm written by a programmer...
specifications but the approach to the original problem is less a procedural language construct and are more oriented toward problem solving
Problem solving
Problem solving is a mental process and is part of the larger problem process that includes problem finding and problem shaping. Consideredthe most complex of all intellectual functions, problem solving has been defined as higher-order cognitive process that requires the modulation and control of...
and systems engineering
Systems engineering
Systems engineering is an interdisciplinary field of engineering that focuses on how complex engineering projects should be designed and managed over the life cycle of the project. Issues such as logistics, the coordination of different teams, and automatic control of machinery become more...
.