HOME

TheInfoList




A low-level programming language is a
programming language A programming language is a formal language In logic, mathematics, computer science, and linguistics, a formal language consists of string (computer science), words whose symbol (formal), letters are taken from an alphabet (computer science) ...

programming language
that provides little or no
abstraction Abstraction in its main sense is a conceptual process where general rules Rule or ruling may refer to: Human activity * The exercise of political Politics (from , ) is the set of activities that are associated with Decision-making, mak ...
from a computer's
instruction set architecture In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , ...
—commands or functions in the language map that are structurally similar to processor's instructions. Generally, this refers to either
machine code In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ge ...
or
assembly language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, gene ...
. Because of the low (hence the word) abstraction between the language and machine language, low-level languages are sometimes described as being "close to the hardware". Programs written in low-level languages tend to be relatively non-portable, due to being optimized for a certain type of system architecture. Low-level languages can convert to machine code without a compiler or interpreter –
second-generation programming languageSecond-generation programming language (2GL) is a generational way to categorize assembly language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific co ...
s use a simpler processor called an
assembler Assembler may refer to: Arts and media * Nobukazu Takemura Nobukazu Takemura (竹村延和 ''Takemura Nobukazu'') is a Japanese musician and artist. Born in Hirakata, Osaka in August 1968, he became interested in music at a young age by listenin ...

assembler
– and the resulting code runs directly on the processor. A program written in a low-level language can be made to run very quickly, with a small
memory footprint Memory footprint refers to the amount of main memory A spindle of DVD-RWs Computer data storage is a technology consisting of computer components and Data storage device, recording media that are used to retain digital data (computing), d ...
. An equivalent program in a
high-level language In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of Algori ...
can be less efficient and use more memory. Low-level languages are simple, but considered difficult to use, due to numerous technical details that the programmer must remember. By comparison, a
high-level programming language In computer science Computer science deals with the theoretical foundations of information, algorithms and the architectures of its computation as well as practical techniques for their application. Computer science is the study of , , ...
isolates execution semantics of a computer architecture from the specification of the program, which simplifies development.


Machine code

Machine code In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ge ...
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 Binary may refer to: Science and technology Mathematics * Binary number In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: ty ...

binary
, data. A programmer coding in "machine code" normally codes instructions and data in a more readable form such as
decimal The decimal numeral system A numeral system (or system of numeration) is a writing system A writing system is a method of visually representing verbal communication Communication (from Latin ''communicare'', meaning "to share") is t ...
,
octal The octal numeral system, or oct for short, is the radix, base-8 number system, and uses the Numerical digit, digits 0 to 7, that is to say 10 represents 8 in decimal and 100 represents 64 in decimal. However, English uses a Base 10, base-10 num ...

octal
, or
hexadecimal In and , the hexadecimal (also base 16 or hex) numeral system is a that represents numbers using a (base) of 16. Unlike the system representing numbers using 10 symbols, hexadecimal uses 16 distinct symbols, most often the symbols "0"–"9 ...
which is translated to internal format by a program called a
loader Loader can refer to: * Loader (equipment) * Loader (computing) ** LOADER.EXE, an auto-start program loader optionally used in the startup process of Microsoft Windows ME * Loader (surname) * Fast loader * Speedloader * Boot loader ** LOADER.COM (ak ...
or toggled into the computer's memory from a
front panel Front may refer to: Arts, entertainment, and media Films * ''The Front'' (1943 film), a 1943 Soviet drama film * ''The Front ''The Front'' is a 1976 comedy-drama Comedy-drama, or dramedy, is a genre of dramatic works that combines element ...

front panel
. Although few programs are written in machine language, programmers often become adept at reading it through working with
core dump In computing, a core dump, memory dump, crash dump, system dump, or ABEND dump consists of the recorded state of the working Computer storage, memory of a computer program at a specific time, generally when the program has crash (computing), crashed ...
s or debugging from the front panel. Example: A function in hexadecimal representation of 32-bit
x86 x86 is a family of instruction set architecture In computer science, an instruction set architecture (ISA), also called computer architecture, is an abstract model of a computer. A device that executes instructions described by that ISA, ...

x86
machine code to calculate the ''n''th
Fibonacci number In mathematics, the Fibonacci numbers, commonly denoted , form a sequence In , a sequence is an enumerated collection of in which repetitions are allowed and matters. Like a , it contains (also called ''elements'', or ''terms''). The numbe ...

Fibonacci number
: 8B542408 83FA0077 06B80000 0000C383 FA027706 B8010000 00C353BB 01000000 B9010000 008D0419 83FA0376 078BD989 C14AEBF1 5BC3


Assembly language

Second-generation languages provide one abstraction level on top of the machine code. In the early days of coding on computers like
TX-0 The TX-0, for ''Transistorized Experimental computer zero'', but affectionately referred to as tixo (pronounced "tix oh"), was an early fully transistor file:MOSFET Structure.png, upright=1.4, Metal-oxide-semiconductor field-effect transistor ...
and
PDP-1 The PDP-1 (''Programmed Data Processor-1'') is the first computer A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operatio ...

PDP-1
, the first thing MIT hackers did was to write assemblers.
Assembly language In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, gene ...
has little
semantics Semantics (from grc, σημαντικός ''sēmantikós'', "significant") is the study of reference Reference is a relationship between objects in which one object designates, or acts as a means by which to connect to or link to, another ...
or formal specification, being only a mapping of human-readable symbols, including symbolic addresses, to
opcode In computing, an opcode (abbreviated from operation code, also known as instruction machine code, instruction code, instruction syllable, instruction parcel or opstring) is the portion of a machine code, machine language instruction (computer sc ...
s, addresses, numeric constants,
strings String or strings may refer to: *String (structure), a long flexible structure made from threads twisted together, which is used to tie, bind, or hang other objects Arts, entertainment, and media Films * Strings (1991 film), ''Strings'' (1991 fil ...
and so on. Typically, one
machine instruction In computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a particular task. Programming involves tasks such as analysis, ge ...
is represented as one line of assembly code. Assemblers produce
object file An object file is a computer file containing object code In computing Computing is any goal-oriented activity requiring, benefiting from, or creating computing machinery. It includes the study and experimentation of algorithmic processes and ...
s that can
link Link or Links may refer to: Places * Link, West Virginia, an unincorporated community in the US * Link River, Klamath Falls, Oregon, US People with the name * Link (singer) (Lincoln Browder, born 1964), American R&B singer * Link (surname) * ...
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 In mathematics, the Fibonacci numbers, commonly denoted , form a sequence In , a sequence is an enumerated collection of in which repetitions are allowed and matters. Like a , it contains (also called ''elements'', or ''terms''). The numbe ...

Fibonacci number
calculator as above, but in x86-64 assembly language using AT&T syntax: _fib: movl $1, %eax xorl %ebx, %ebx .fib_loop: cmpl $1, %edi jbe .fib_done movl %eax, %ecx addl %ebx, %eax movl %ecx, %ebx subl $1, %edi jmp .fib_loop .fib_done: ret In this code example, hardware features of the x86-64 processor (its registers) are named and manipulated directly. The function loads its input from ''%edi'' in accordance to the System V ABI and performs its calculation by manipulating values in the EAX, EBX, and ECX registers until it has finished and returns. Note that in this assembly language, there is no concept of returning a value. The result having been stored in the EAX register, the RET command simply moves code processing to the code location stored on the stack (usually the instruction immediately after the one that called this function) and it is up to the author of the calling code to know that this function stores its result in EAX and to retrieve it from there. x86-64 assembly language imposes no standard for returning values from a function (and so, in fact, has no concept of a function); it is up to the calling code to examine state after the procedure returns if it needs to extract a value. Compare this with the same function in C: unsigned int fib(unsigned int n) This code is very similar in structure to the assembly language example but there are significant differences in terms of abstraction: * The input (parameter n) is an abstraction that does not specify any storage location on the hardware. In practice, the C compiler follows one of many possible calling conventions to determine a storage location for the input. * The assembly language version loads the input parameter from the stack into a register and in each iteration of the loop decrements the value in the register, never altering the value in the memory location on the stack. The C compiler could load the parameter into a register and do the same or could update the value wherever it is stored. Which one it chooses is an implementation decision completely hidden from the code author (and one with no
side effects In medicine, a side effect is an effect, whether therapeutic or adverse, that is secondary to the one intended; although the term is predominantly employed to describe adverse effects, it can also apply to beneficial, but unintended, consequences ...
, thanks to C language standards). * The local variables a, b and c are abstractions that do not specify any specific storage location on the hardware. The C compiler decides how to actually store them for the target architecture. * The return function specifies the value to return, but does not dictate ''how'' it is returned. The C compiler for any specific architecture implements a standard mechanism for returning the value. Compilers for the x86 architecture typically (but not always) use the EAX register to return a value, as in the assembly language example (the author of the assembly language example has ''chosen'' to copy the C convention but assembly language does not require this). These abstractions make the C code compilable without modification on any architecture for which a C compiler has been written. The x86 assembly language code is specific to the x86 architecture.


Low-level programming in high-level languages

In the late 1960s, high-level languages such as
PL/SPL/S, short for Programming Language/Systems, is a "machine-oriented" programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/output, out ...
,
BLISS BLISS is a system programming language A system programming language is a programming language A programming language is a formal language comprising a Instruction set architecture, set of instructions that produce various kinds of Input/outp ...

BLISS
,
BCPL BCPL ("Basic Combined Programming Language") is a procedural, imperative Imperative may refer to: *Imperative mood, a grammatical mood (or mode) expressing commands, direct requests, and prohibitions *Imperative programming, a programming pa ...
, extended
ALGOL ALGOL (; short for "Algorithmic Language") is a family of imperative Imperative may refer to: *Imperative mood, a grammatical mood (or mode) expressing commands, direct requests, and prohibitions *Imperative programming, a programming paradigm ...
(for
Burroughs large systems The Burroughs Large Systems Group produced a family of large 48-bit mainframe A pair of IBM mainframes. On the left is the IBM z Systems z13. On the right is the IBM LinuxONE Rockhopper.">IBM_LinuxONE.html" ;"title="IBM z Systems z13. On the ...
) and C included some degree of access to low-level programming functions. One method for this is
Inline assemblyIn computer programming Computer programming is the process of designing and building an executable computer program to accomplish a specific computing result or to perform a specific task. Programming involves tasks such as: analysis, generatin ...
, in which assembly code is embedded in a high-level language that supports this feature. Some of these languages also allow architecture-dependent compiler optimization directives to adjust the way a compiler uses the target processor architecture.


References

{{DEFAULTSORT:Low-Level Programming Language Programming language classification Articles with example C code