High-level programming language: Difference between revisions

From Wikipedia, the free encyclopedia
Jump to navigation Jump to search
Edited citation.
 
imported>Holly.standring
m Amend incorrect Lisp redirect
 
(One intermediate revision by one other user not shown)
Line 3: Line 3:
{{Use American English|date=January 2019}}
{{Use American English|date=January 2019}}


A '''high-level programming language''' is a [[programming language]] with strong [[Abstraction (computer science)|abstraction]] from the details of the [[computer]]. In contrast to [[low-level programming language]]s, it may use [[natural language]] ''elements'', be easier to use, or may automate (or even hide entirely) significant areas of computing systems (e.g. [[memory management]]), making the process of developing a program simpler and more understandable than when using a lower-level language. The amount of abstraction provided defines how "high-level" a programming language is.<ref>{{cite web |archive-url=https://web.archive.org/web/20070826224349/http://www.ittc.ku.edu/hybridthreads/glossary/index.php |archive-date=2007-08-26 |url=http://www.ittc.ku.edu/hybridthreads/glossary/index.php |url-status=dead |title=HThreads - RD Glossary<!-- Bot generated title -->}}</ref>
A '''high-level programming language''' is a [[programming language]] with strong [[Abstraction (computer science)|abstraction]] from the details of the [[computer]]. In contrast to [[low-level programming language]]s, it may use [[natural language]] elements, be easier to use, or may automate (or even hide entirely) significant areas of computing systems (e.g. [[memory management]]), making the process of developing a program simpler and more understandable than when using a lower-level language. The amount of abstraction provided defines how "high-level" a programming language is.<ref>{{cite web |archive-url=https://web.archive.org/web/20070826224349/http://www.ittc.ku.edu/hybridthreads/glossary/index.php |archive-date=2007-08-26 |url=http://www.ittc.ku.edu/hybridthreads/glossary/index.php |url-status=dead |title=HThreads - RD Glossary<!-- Bot generated title -->}}</ref>


In the 1960s, a high-level programming language using a [[compiler]] was commonly called an ''[[autocode]]''.<ref name=kleith>{{cite book|last=London|first=Keith|year=1968|title=Introduction to Computers|publisher=Faber and Faber Limited|location=24 Russell Square London WC1|isbn=0571085938|page=184|chapter=4, Programming|quote=The 'high' level programming languages are often called autocodes and the processor program, a compiler.}}<!--The book has no ISBN number, instead it has an SBN number. There is no typo in the prior sentence.--></ref>
''High-level'' refers to a level of abstraction from the hardware details of a [[CPU |processor]] inherent in [[machine code |machine]] and [[assembly language| assembly]] code. Rather than dealing with registers, memory addresses, and call stacks, high-level languages deal with variables, arrays, [[object (computer science)|object]]s, arithmetic and [[Boolean expression]]s, [[function (computing)|functions]], loops, [[Thread (computer science)|thread]]s, locks, and other computer science abstractions, intended to facilitate [[Correctness (computer science)|correctness]] and [[software maintenance |maintainability]]. Unlike low-level [[assembly language]]s, high-level languages have few, if any, language elements that translate directly to a machine's native [[opcode]]s. Other features, such as string handling, [[object-oriented programming]] features, and file input/output, may also be provided. A high-level language allows for source code that is detached and separated from the machine details. That is, unlike low-level languages like assembly and machine code, high-level language code may result in data movements without the programmer's knowledge. Some control of what instructions to execute is handed to the compiler.
Examples of autocodes are [[COBOL]] and [[Fortran]].<ref name=kleith2>{{cite book|last=London|first=Keith|title=Introduction to Computers|year=1968|publisher=Faber and Faber Limited|location=24 Russell Square London WC1|isbn=0571085938|page=186|chapter=4, Programming|quote=Two high level programming languages which can be used here as examples to illustrate the structure and purpose of autocodes are COBOL (Common Business Oriented Language) and FORTRAN (Formular Translation).}}<!--The book has no ISBN number, instead it has an SBN number. There is no typo in the prior sentence.--></ref>


The first high-level programming language designed for computers was [[Plankalkül]], created by [[Konrad Zuse]].<ref>{{ill|Wolfgang Giloi{{!}}Giloi, Wolfgang, K.|de|Wolfgang Giloi}} (1997). "Konrad Zuse's Plankalkül: The First High-Level "non von Neumann" Programming Language". IEEE Annals of the History of Computing, vol. 19, no. 2, pp.&nbsp;17–24,  April–June, 1997. [http://doi.ieeecomputersociety.org/10.1109/85.586068 (abstract)]</ref> However, it was not implemented in his time, and his original contributions were largely isolated from other developments due to [[World War II]], aside from the language's influence on the "Superplan" language by [[Heinz Rutishauser]] and also to some degree [[ALGOL]]. The first significantly widespread high-level language was [[Fortran]], a machine-independent development of IBM's earlier [[Autocode]] systems. The [[ALGOL]] family, with [[ALGOL 58]] defined in 1958 and [[ALGOL 60]] defined in 1960 by committees of European and American computer scientists, introduced [[recursion]] as well as [[nested functions]] under [[lexical scope]]. ALGOL 60 was also the first language with a clear distinction between [[call by value|value]] and [[call by name|name-parameter]]s and their corresponding [[Semantics (computer science)|semantics]].<ref>Although it lacked a notion of [[call by reference|reference-parameter]]s, which could be a problem in some situations. Several successors, including [[ALGOL W]], [[ALGOL 68]], [[Simula]], [[Pascal (programming language)|Pascal]], [[Modula]] and [[Ada (programming language)|Ada]] thus included reference-parameters (The related C-language family instead allowed addresses as <code>value</code>-parameters).</ref> ALGOL also introduced several [[structured programming]] concepts, such as the <code>while-do</code> and <code>if-then-else</code> constructs and its [[Syntax (programming languages)|syntax]] was the first to be described in formal notation – ''[[Backus–Naur form]]'' (BNF). During roughly the same period, [[COBOL]] introduced [[Record (computer science)|record]]s (also called structs) and [[Lisp (programming language)|Lisp]] introduced a fully general [[lambda abstraction]] in a programming language for the first time.
==History==
{{Expand section|examples of more recent high-level programming languages|date=November 2025}}
In the 1960s, the term ''[[autocode]]'' was commonly used to describe a high-level programming language that relied on a compiler. Notable examples of such autocodes include COBOL and Fortran.


== Features ==
The earliest high-level programming language ever designed for computers was [[Plankalkül]], developed by Konrad Zuse. However, it was never implemented during his lifetime, and his pioneering work remained largely disconnected from other advancements due to the disruptions of World War II. Even so, Plankalkül influenced Heinz Rutishauser’s [[Superplan]] language and, to a lesser extent, the development of ALGOL.
"High-level language" refers to the higher level of abstraction from [[machine language]]. Rather than dealing with registers, memory addresses, and call stacks, high-level languages deal with variables, arrays, [[object (computer science)|object]]s, complex arithmetic or [[Boolean expression|Boolean expressions]], subroutines and functions, loops, [[Thread (computer science)|thread]]s, locks, and other abstract computer science concepts, with a focus on [[usability]] over optimal program efficiency. Unlike low-level [[assembly language]]s, high-level languages have few, if any, language elements that translate directly into a machine's native [[opcode]]s. Other features, such as string handling routines, [[Object-oriented programming|object-oriented language]] features, and file input/output, may also be present. One thing to note about high-level programming languages is that these languages allow the programmer to be detached and separated from the machine. That is, unlike low-level languages like assembly or machine language, high-level programming can amplify the programmer's instructions and trigger a lot of data movements in the background without their knowledge. The responsibility and power of executing instructions have been handed over to the machine from the programmer.


== Abstraction penalty ==
The first high-level language to achieve widespread adoption was [[Fortran]], a machine-independent evolution of IBM’s earlier Autocode systems. Around the same time, the [[ALGOL]] family emerged—ALGOL 58 in 1958 and ALGOL 60 in 1960—created by joint committees of European and American computer scientists. ALGOL introduced key innovations such as recursion, nested functions under lexical scope, and a clear distinction between value and name parameters with their respective semantics. It also pioneered several structured programming concepts, including the ''while-do'' loop and ''if-then-else'' statements, and became the first language whose syntax was formally defined using [[Backus–Naur form]] (BNF).
High-level languages intend to provide features that standardize common tasks, permit rich debugging, and maintain architectural agnosticism; while low-level languages often produce more efficient code through [[program optimization|optimization]] for a specific [[Computer architecture|system architecture]]. ''Abstraction penalty'' is the cost that high-level programming techniques pay for being unable to optimize performance or use certain hardware because they don't take advantage of certain low-level architectural resources. High-level programming exhibits features like more generic data structures and operations, run-time interpretation, and intermediate code files; which often result in execution of far more operations than necessary, higher memory consumption, and larger binary program size.<ref>{{cite journal
 
Meanwhile, [[COBOL]] brought the concept of [[Record (computer science)|records]] (also known as structs) into mainstream programming, and [[Lisp (programming language)|Lisp]] became the first language to implement a fully general [[Anonymous function|lambda abstraction]].
 
==Abstraction penalty==
A high-level language provides features that standardize common tasks, permit rich debugging, and maintain architectural agnosticism. On the other hand, a low-level language requires the coder to work at a lower-level of abstraction which is generally more challenging, but does allow for [[program optimization |optimizations]] that are not possible with a high-level language. This ''abstraction penalty'' for using a high-level language instead of a low-level language is real, but in practice, low-level optimizations rarely improve performance at the [[user experience]] level.<ref>{{cite journal
  |author=Surana P  
  |author=Surana P  
  |title=Meta-Compilation of Language Abstractions.  
  |title=Meta-Compilation of Language Abstractions.  
Line 43: Line 47:
   | pages = 367
   | pages = 367
   | publisher = Springer
   | publisher = Springer
   }}</ref> For this reason, code which needs to run particularly quickly and efficiently may require the use of a lower-level language, even if a higher-level language would make the coding easier. In many cases, critical portions of a program mostly in a high-level language can be hand-coded in [[assembly language]], leading to a much faster, more efficient, or simply reliably functioning [[Program optimisation|optimised program]].
   }}</ref> None the less, code that needs to run quickly and efficiently may require the use of a lower-level language, even if a higher-level language would make the coding easier to write and maintain. In many cases, critical portions of a program mostly in a high-level language are coded in assembly in order to meet tight timing or memory constraints. A well-designed compiler for a high-level language can produce code comparable in efficiency to what could be coded by hand in assembly, and the higher-level abstractions sometimes allow for optimizations that beat the performance of hand-coded assembly.<ref>
 
However, with the growing complexity of modern [[microprocessor]] architectures, well-designed compilers for high-level languages frequently produce code comparable in efficiency to what most low-level programmers can produce by hand, and the higher abstraction may allow for more powerful techniques providing better overall results than their low-level counterparts in particular settings.<ref>
{{Cite journal
{{Cite journal
   |author1=Manuel Carro |author2=José F. Morales |author3=Henk L. Muller |author4=G. Puebla |author5=M. Hermenegildo | journal = Proceedings of the 2006 International Conference on Compilers, Architecture and Synthesis for Embedded Systems
   |author1=Manuel Carro |author2=José F. Morales |author3=Henk L. Muller |author4=G. Puebla |author5=M. Hermenegildo | journal = Proceedings of the 2006 International Conference on Compilers, Architecture and Synthesis for Embedded Systems
Line 52: Line 54:
   | year = 2006
   | year = 2006
   | publisher = ACM
   | publisher = ACM
   }}</ref>
   }}</ref> Since a high-level language is designed independent of a specific computing [[Computer architecture |system architecture]], a program written in such a language can run on any computing context with a compatible compiler or interpreter.
High-level languages are designed independent of a specific computing [[Computer architecture|system architecture]]. This facilitates executing a program written in such a language on any computing system with compatible support for the Interpreted or [[Just-in-time compilation|JIT]] program. High-level languages can be improved as their designers develop improvements. In other cases, new high-level languages evolve from one or more others with the goal of aggregating the most popular constructs with new or improved features. An example of this is [[Scala (programming language)|Scala]] which maintains backward compatibility with [[Java (programming language)|Java]], meaning that programs and libraries written in Java will continue to be usable even if a programming shop switches to Scala; this makes the transition easier and the lifespan of such high-level coding indefinite. In contrast, low-level programs rarely survive beyond the [[Computer architecture|system architecture]] which they were written for without major revision. This is the engineering 'trade-off' for the 'Abstraction Penalty'.
 
Unlike a low-level language that is inherently tied to processor hardware, a high-level language can be improved, and new high-level languages can evolve from others with the goal of aggregating the most popular constructs with improved features. For example, [[Scala (programming language)|Scala]] maintains backward compatibility with [[Java (programming language)|Java]]. Code written in Java continue to be usable even if a developer switches to Scala. This makes the transition easier and extends the lifespan of a [[codebase]]. In contrast, low-level programs rarely survive beyond the [[Computer architecture |system architecture]] which they were written for.


== Relative meaning ==
== Relative meaning ==
{{refimprove section|small=y|date=October 2018}}
{{refimprove section|date=October 2018}}
Examples of high-level programming languages in active use today include [[Python (programming language)|Python]], [[JavaScript]], [[Visual Basic]], [[Delphi (programming language)|Delphi]], [[Perl]], [[PHP]], [[ECMAScript]], [[Ruby (programming language)|Ruby]], [[C Sharp (programming language)|C#]], [[Java (programming language)|Java]] and many others.


The terms ''high-level'' and ''low-level'' are inherently relative. Some decades ago,{{clarify timeframe|date=July 2023}} the [[C (programming language)|C language]], and similar languages, were most often considered "high-level", as it supported concepts such as expression evaluation, [[parameter]]ised recursive functions, and data types and structures, while [[assembly language]] was considered "low-level". Today, many programmers might refer to C as low-level, as it lacks a large [[Runtime system|runtime-system]] (no garbage collection, etc.), basically supports only scalar operations, and provides direct memory addressing; it therefore, readily blends with assembly language and the machine level of [[CPU]]s and [[microcontroller]]s. Also, in the introduction chapter of [[The C Programming Language]] (second edition) by [[Brian Kernighan]] and [[Dennis Ritchie]], C is described as "not a very high level" language.<ref>{{cite book|last1=Kernighan|first1=Brian W.|last2=Ritchie|first2=Dennis M.|date=1988|title=The C Programming Language: 2nd Edition|url=https://books.google.com/books?id=FGkPBQAAQBAJ|url-status=bot: unknown|publisher=Prentice Hall|isbn=9780131103627|archive-url=https://web.archive.org/web/20221025180501/https://books.google.com/books?id=FGkPBQAAQBAJ|archive-date=25 October 2022|access-date=25 October 2022}}</ref>
The terms ''high-level'' and ''low-level'' are inherently relative, and languages can be compared as higher or lower level to each other. Sometimes the [[C (programming language)|C language]] is considered as either high-level or low-level depending on one's perspective. Regardless, most agree that C is higher level than assembly and lower level than most other languages.


Assembly language may itself be regarded as a higher level (but often still one-to-one if used without [[Macro (computer science)|macro]]s) representation of [[machine code]], as it supports concepts such as constants and (limited) expressions, sometimes even variables, procedures, and [[data structure]]s. [[Machine code]], in turn, is inherently at a slightly higher level than the [[microcode]] or [[micro-operation]]s used internally in many processors.<ref>{{Cite book|title=The art of assembly language|last=Hyde, Randall.|date=2010|publisher=No Starch Press|isbn=9781593273019|edition= 2nd|location=San Francisco|oclc=635507601|url=https://books.google.com/books?id=sYHtTvQ-ObIC}}</ref>
C supports constructs such as expression evaluation, [[parameter |parameterized]] and recursive functions, data types and structures which are generally not supported in assembly or directly by a processor but C does provide lower-level features such as auto-increment and pointer math. But C lacks many higher-level abstracts common in other languages such as [[garbage collection]] and a built-in string type. In the introduction of [[The C Programming Language]] (second edition) by [[Brian Kernighan]] and [[Dennis Ritchie]], C is described as "not a very high level" language.<ref>{{cite book|last1=Kernighan|first1=Brian W.|last2=Ritchie|first2=Dennis M.|date=1988|title=The C Programming Language: 2nd Edition|url=https://books.google.com/books?id=FGkPBQAAQBAJ|url-status=bot: unknown|publisher=Prentice Hall|isbn=9780131103627|archive-url=https://web.archive.org/web/20221025180501/https://books.google.com/books?id=FGkPBQAAQBAJ|archive-date=25 October 2022|access-date=25 October 2022}}</ref>
 
Assembly language is higher-level than machine code, but still highly tied to the processor hardware. However, assembly may provide some higher-level features such as [[Macro (computer science)|macro]]s, relatively limited expressions, constants, variables, procedures, and [[data structure]]s.  
 
[[Machine code]] is at a slightly higher level abstraction than the [[microcode]] or [[micro-operation]]s used internally in many processors.<ref>{{Cite book|title=The art of assembly language|last=Hyde, Randall.|date=2010|publisher=No Starch Press|isbn=9781593273019|edition= 2nd|location=San Francisco|oclc=635507601|url=https://books.google.com/books?id=sYHtTvQ-ObIC}}</ref>


== Execution modes ==
== Execution modes ==
{{refimprove section|find=Execution modes|date=October 2018}}
{{refimprove section|find=Execution modes|date=October 2018}}
There are three general modes of execution for modern high-level languages:
The source code of a high-level language may be processed in various ways, such as:
; Interpreted: When code written in a language is [[Interpreted language|interpreted]], its syntax is read and then executed directly, with no compilation stage. A program called an ''interpreter'' reads each program statement, following the program flow, then decides what to do, and does it. A hybrid of an interpreter and a compiler will compile the statement into machine code and execute that; the machine code is then discarded, to be interpreted anew if the line is executed again. Interpreters are commonly the simplest implementations of the behavior of a language, compared to the other two variants listed here.
 
; Compiled: When code written in a language is [[Compiled language|compiled]], its syntax is transformed into an executable form before running. There are two types of compilation:
; Compiled: A [[compiler]] transforms source code into other code. In some cases, a compiler generates native machine code that is interpreted by the processor; however, many execution models today involve generating an [[intermediate representation]] (i.e. [[bytecode]]) that is later interpreted in software or converted to native code at runtime (via [[JIT compilation]]).
:; Machine code generation: Some compilers compile source code directly into [[machine code]]. This is the original mode of compilation, and languages that are directly and completely transformed to machine-native code in this way may be called ''truly compiled'' languages. See [[assembly language]].
 
:; Intermediate representations: When code written in a language is compiled to an [[intermediate representation]], that representation can be optimized or saved for later execution without the need to re-read the source file. When the intermediate representation is saved, it may be in a form such as [[bytecode]]. The intermediate representation must then be interpreted or further compiled to execute it. [[Virtual machine]]s that execute bytecode directly or transform it further into machine code have blurred the once clear distinction between intermediate representations and truly compiled languages.
; [[Transpiled]]: Code may be translated into source code of another language (typically lower-level) for which a compiler or interpreter is available. [[JavaScript]] and the [[C (programming language)|C]] are common targets for such translators. For example, C and C++ code can be seen as generated from Eiffel code when using the [[EiffelStudio]] IDE. In Eiffel, the ''translated'' process is referred to as ''transcompiling'' or ''transcompiled'', and the Eiffel compiler as a transcompiler or [[source-to-source compiler]].
; Source-to-source translated or transcompiled: Code written in a language may be translated into terms of a lower-level language for which native code compilers are already common. [[JavaScript]] and the language [[C (programming language)|C]] are common targets for such translators. See [[CoffeeScript]], [[Chicken (Scheme implementation)|Chicken]] Scheme, and [[Eiffel (programming language)|Eiffel]] as examples. Specifically, the generated C and C++ code can be seen (as generated from the Eiffel language when using the [[EiffelStudio]] IDE) in the EIFGENs directory of any compiled Eiffel project. In Eiffel, the ''translated'' process is referred to as transcompiling or transcompiled, and the Eiffel compiler as a transcompiler or [[source-to-source compiler]].
 
; Software interpreted: A [[interpreter (software)|software interpreter]] performs the actions encoded in source code without generating native machine code.


Note that languages are not strictly ''interpreted'' languages or ''compiled'' languages. Rather, implementations of language behavior use interpreting or compiling. For example, [[ALGOL 60]] and [[Fortran]] have both been interpreted (even though they were more typically compiled). Similarly, Java shows the difficulty of trying to apply these labels to languages, rather than to implementations; Java is compiled to bytecode which is then executed by either interpreting (in a [[Java virtual machine]] (JVM)) or compiling (typically with a just-in-time compiler such as [[HotSpot (virtual machine)|HotSpot]], again in a JVM). Moreover, compiling, transcompiling, and interpreting is not strictly limited to only a description of the compiler artifact (binary executable or IL assembly).
; Hardware interpreted: Although uncommon, a processor with a [[high-level language computer architecture]] can process a high-level language without a compilation step. For example, the [[Burroughs large systems]] were target machines for [[ALGOL 60]].<ref>{{Citation|last=Chu|first=Yaohan|chapter=Concepts of High-Level Language Computer Architecture|date=1975|pages=1–14|publisher=Elsevier|isbn=9780121741501|doi=10.1016/b978-0-12-174150-1.50007-0|title=High-Level Language Computer Architecture}}</ref>


=== High-level language computer architecture ===
Note that a language is not strictly interpreted or compiled. Rather, an execution model involves a compiler or an interpreter and the same language might be used with different execution models. For example, [[ALGOL 60]] and [[Fortran]] have both been interpreted even though they were more typically compiled. Similarly, Java shows the difficulty of trying to apply these labels to languages, rather than to implementations. Java is compiled to bytecode which is then executed by either interpreting in a [[Java virtual machine]] (JVM) or JIT compiled.
Alternatively, it is possible for a high-level language to be directly implemented by a computer – the computer directly executes the HLL code. This is known as a ''[[high-level language computer architecture]]'' – the [[computer architecture]] itself is designed to be targeted by a specific high-level language. The [[Burroughs large systems]] were target machines for [[ALGOL 60]], for example.<ref>{{Citation|last=Chu|first=Yaohan|chapter=Concepts of High-Level Language Computer Architecture|date=1975|pages=1–14|publisher=Elsevier|isbn=9780121741501|doi=10.1016/b978-0-12-174150-1.50007-0|title=High-Level Language Computer Architecture}}</ref>


== See also ==
== See also ==

Latest revision as of 14:44, 17 December 2025

Template:Short description Template:Use dmy dates Template:Use American English

A high-level programming language is a programming language with strong abstraction from the details of the computer. In contrast to low-level programming languages, it may use natural language elements, be easier to use, or may automate (or even hide entirely) significant areas of computing systems (e.g. memory management), making the process of developing a program simpler and more understandable than when using a lower-level language. The amount of abstraction provided defines how "high-level" a programming language is.[1]

High-level refers to a level of abstraction from the hardware details of a processor inherent in machine and assembly code. Rather than dealing with registers, memory addresses, and call stacks, high-level languages deal with variables, arrays, objects, arithmetic and Boolean expressions, functions, loops, threads, locks, and other computer science abstractions, intended to facilitate correctness and maintainability. Unlike low-level assembly languages, high-level languages have few, if any, language elements that translate directly to a machine's native opcodes. Other features, such as string handling, object-oriented programming features, and file input/output, may also be provided. A high-level language allows for source code that is detached and separated from the machine details. That is, unlike low-level languages like assembly and machine code, high-level language code may result in data movements without the programmer's knowledge. Some control of what instructions to execute is handed to the compiler.

History

Script error: No such module "Unsubst". In the 1960s, the term autocode was commonly used to describe a high-level programming language that relied on a compiler. Notable examples of such autocodes include COBOL and Fortran.

The earliest high-level programming language ever designed for computers was Plankalkül, developed by Konrad Zuse. However, it was never implemented during his lifetime, and his pioneering work remained largely disconnected from other advancements due to the disruptions of World War II. Even so, Plankalkül influenced Heinz Rutishauser’s Superplan language and, to a lesser extent, the development of ALGOL.

The first high-level language to achieve widespread adoption was Fortran, a machine-independent evolution of IBM’s earlier Autocode systems. Around the same time, the ALGOL family emerged—ALGOL 58 in 1958 and ALGOL 60 in 1960—created by joint committees of European and American computer scientists. ALGOL introduced key innovations such as recursion, nested functions under lexical scope, and a clear distinction between value and name parameters with their respective semantics. It also pioneered several structured programming concepts, including the while-do loop and if-then-else statements, and became the first language whose syntax was formally defined using Backus–Naur form (BNF).

Meanwhile, COBOL brought the concept of records (also known as structs) into mainstream programming, and Lisp became the first language to implement a fully general lambda abstraction.

Abstraction penalty

A high-level language provides features that standardize common tasks, permit rich debugging, and maintain architectural agnosticism. On the other hand, a low-level language requires the coder to work at a lower-level of abstraction which is generally more challenging, but does allow for optimizations that are not possible with a high-level language. This abstraction penalty for using a high-level language instead of a low-level language is real, but in practice, low-level optimizations rarely improve performance at the user experience level.[2][3][4] None the less, code that needs to run quickly and efficiently may require the use of a lower-level language, even if a higher-level language would make the coding easier to write and maintain. In many cases, critical portions of a program mostly in a high-level language are coded in assembly in order to meet tight timing or memory constraints. A well-designed compiler for a high-level language can produce code comparable in efficiency to what could be coded by hand in assembly, and the higher-level abstractions sometimes allow for optimizations that beat the performance of hand-coded assembly.[5] Since a high-level language is designed independent of a specific computing system architecture, a program written in such a language can run on any computing context with a compatible compiler or interpreter.

Unlike a low-level language that is inherently tied to processor hardware, a high-level language can be improved, and new high-level languages can evolve from others with the goal of aggregating the most popular constructs with improved features. For example, Scala maintains backward compatibility with Java. Code written in Java continue to be usable even if a developer switches to Scala. This makes the transition easier and extends the lifespan of a codebase. In contrast, low-level programs rarely survive beyond the system architecture which they were written for.

Relative meaning

Template:Refimprove section

The terms high-level and low-level are inherently relative, and languages can be compared as higher or lower level to each other. Sometimes the C language is considered as either high-level or low-level depending on one's perspective. Regardless, most agree that C is higher level than assembly and lower level than most other languages.

C supports constructs such as expression evaluation, parameterized and recursive functions, data types and structures which are generally not supported in assembly or directly by a processor but C does provide lower-level features such as auto-increment and pointer math. But C lacks many higher-level abstracts common in other languages such as garbage collection and a built-in string type. In the introduction of The C Programming Language (second edition) by Brian Kernighan and Dennis Ritchie, C is described as "not a very high level" language.[6]

Assembly language is higher-level than machine code, but still highly tied to the processor hardware. However, assembly may provide some higher-level features such as macros, relatively limited expressions, constants, variables, procedures, and data structures.

Machine code is at a slightly higher level abstraction than the microcode or micro-operations used internally in many processors.[7]

Execution modes

Template:Refimprove section The source code of a high-level language may be processed in various ways, such as:

Compiled
A compiler transforms source code into other code. In some cases, a compiler generates native machine code that is interpreted by the processor; however, many execution models today involve generating an intermediate representation (i.e. bytecode) that is later interpreted in software or converted to native code at runtime (via JIT compilation).
Transpiled
Code may be translated into source code of another language (typically lower-level) for which a compiler or interpreter is available. JavaScript and the C are common targets for such translators. For example, C and C++ code can be seen as generated from Eiffel code when using the EiffelStudio IDE. In Eiffel, the translated process is referred to as transcompiling or transcompiled, and the Eiffel compiler as a transcompiler or source-to-source compiler.
Software interpreted
A software interpreter performs the actions encoded in source code without generating native machine code.
Hardware interpreted
Although uncommon, a processor with a high-level language computer architecture can process a high-level language without a compilation step. For example, the Burroughs large systems were target machines for ALGOL 60.[8]

Note that a language is not strictly interpreted or compiled. Rather, an execution model involves a compiler or an interpreter and the same language might be used with different execution models. For example, ALGOL 60 and Fortran have both been interpreted even though they were more typically compiled. Similarly, Java shows the difficulty of trying to apply these labels to languages, rather than to implementations. Java is compiled to bytecode which is then executed by either interpreting in a Java virtual machine (JVM) or JIT compiled.

See also

Script error: No such module "Portal".

References

<templatestyles src="Reflist/styles.css" />

  1. Script error: No such module "citation/CS1".
  2. Script error: No such module "Citation/CS1".
  3. Script error: No such module "citation/CS1".
  4. Script error: No such module "citation/CS1".
  5. Script error: No such module "Citation/CS1".
  6. Script error: No such module "citation/CS1".
  7. Script error: No such module "citation/CS1".
  8. Script error: No such module "citation/CS1".

Script error: No such module "Check for unknown parameters".

External links

Script error: No such module "Navbox". Template:Authority control