==Abstraction penalty==
HighA high-level languages intend tolanguage provideprovides features that standardize common tasks, permit rich debugging, and maintain architectural agnosticism;. whileOn low-levelthe languagesother oftenhand, producea morelow-level efficientlanguage coderequires throughthe [[programcoder optimizationto |optimization]]work forat a specificlower-level [[Computerof architectureabstraction |system architecture]]. ''Abstraction penalty''which is thegenerally costmore thatchallenging, high-levelbut programmingdoes techniques payallow for being[[program unableoptimization to|optimizations]] optimizethat performanceare ornot usepossible certainwith hardwarea because they don't take advantage of certain lowhigh-level architectural resourceslanguage. High-levelThis programming''abstraction exhibitspenalty'' featuresfor likeusing morea generichigh-level datalanguage structuresinstead andof operations,a runlow-timelevel interpretation,language andis intermediatereal, code files; which often resultbut in executionpractice, oflow-level faroptimizations morerarely operationsimprove thanperformance necessary,at higherthe memory[[user consumption, andexperience]] larger binary program sizelevel.<ref>{{cite journal
|author=Surana P
|title=Meta-Compilation of Language Abstractions.
| pages = 367
| publisher = Springer
}}</ref> ForNone thisthe reasonless, code whichthat 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 to write and maintain. In many cases, critical portions of a program mostly in a high-level language canare be hand-coded in [[assembly language]],in leadingorder to meet tight timing or memory constraints. A well-designed compiler for a muchhigh-level faster,language morecan efficientproduce code comparable in efficiency to what could be coded by hand in assembly, orand simplythe reliablyhigher-level functioningabstractions [[Programsometimes optimisation|optimisedallow program]]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
|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
| year = 2006
| publisher = ACM
}}</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.
}}</ref>
High-level languages are designed independent ofUnlike a specificlow-level computinglanguage [[Computerthat architecture|systemis architecture]].inherently Thistied facilitatesto executingprocessor a program written in suchhardware, a language on any computing system with compatible support for the Interpreted or [[Just-in-time compilation|JIT]] program. Highhigh-level languageslanguage can be improved, as their designers develop improvements. In other cases,and new high-level languages can evolve from one or more others with the goal of aggregating the most popular constructs with new or improved features. AnFor example of this is, [[Scala (programming language)|Scala]] which maintains backward compatibility with [[Java (programming language)|Java]],. meaning that programs and librariesCode written in Java will continue to be usable even if a programming shopdeveloper switches to Scala;. thisThis makes the transition easier and extends the lifespan of sucha high-level coding indefinite[[codebase]]. 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'.
== Relative meaning ==
{{refimprove section|small=y|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, 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.
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. 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 supportedsupports conceptsconstructs such as expression evaluation, [[parameter |parameterized]] ised and recursive functions, and data types and structures , whilewhich [[assemblyare language]]generally wasnot consideredsupported "low-level".in Today,assembly manyor programmersdirectly mightby refera toprocessor but C asdoes provide lowlower-level , asfeatures itsuch lacksas a large [[Runtime system|runtimeauto- system]]increment (noand garbagepointer collection, etcmath. ), basicallyBut supportsC onlylacks scalarmany operations,higher-level andabstracts providescommon directin memoryother addressing;languages itsuch therefore,as readily[[garbage blends with assembly languagecollection]] and thea machinebuilt-in levelstring of [[CPU]]s and [[microcontroller]]stype. Also, inIn 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>
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> ▼
Assembly language is higher-level than machine code, but still highly tied to the processor hardware. But, assembly may provide some higher-level features such as [[Macro (computer science)|macro]]s, relatively limited expressions, constants, variables, procedures, and [[data structure]]s.
▲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 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 ==
{{refimprove section|find=Execution modes|date=October 2018}}
The source code of a high-level language may be processed in various ways, including
There are three general modes of execution for modern high-level languages:
; 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: A [[compiler]] transforms source code into other code. Sometimes, and traditionally, a compiler generates native machine code that is interpreted by the processor. But, today many execution models involve generating an [[intermediate representation]] (i.e. [[bytecode]]) that is later interpreted in software or converted to native code at runtime (via [[JIT compilation]]).
; 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:
:; 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]].
; Source-to-source translated or transcompiled[[Transpiled]]: Code written in a language may be translated into termssource code of aanother language (typically lower-level language) for which nativea codecompiler compilersor areinterpreter alreadyis commonavailable. [[JavaScript]] and the language [[C (programming language)|C]] are common targets for such translators. SeeFor [[CoffeeScript]]example, [[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 languagecode 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]]. ▼
:; 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.
▲; 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.
Alternatively,; itHardware isinterpreted: possibleAlthough foruncommon, a high-levelprocessor language to be directly implemented by a computer – the computer directly executes the HLL code. This is known aswith a ''[[high-level language computer architecture]] '' –can theprocess [[computera architecture]]high-level itselflanguage iswithout designeda tocompilation bestep. targetedFor byexample, a specific high-level language. Thethe [[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> ▼
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). ▼
▲Note that languagesa arelanguage is not strictly ''interpreted '' languages or ''compiled '' languages. Rather, implementationsan ofexecution languagemodel behaviorinvolves usea interpretingcompiler or compilingan 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 compilingJIT (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)compiled.
=== High-level language computer architecture ===
▲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 ==
|