Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Compiler
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Types == One classification of compilers is by the [[Computing platform|platform]] on which their generated code executes. This is known as the ''target platform.'' A ''native'' or ''hosted'' compiler is one whose output is intended to directly run on the same type of computer and operating system that the compiler itself runs on. The output of a [[cross compiler]] is designed to run on a different platform. Cross compilers are often used when developing software for [[embedded system]]s that are not intended to support a software development environment. The output of a compiler that produces code for a [[virtual machine]] (VM) may or may not be executed on the same platform as the compiler that produced it. For this reason, such compilers are not usually classified as native or cross compilers. The lower level language that is the target of a compiler may itself be a [[high-level programming language]]. C, viewed by some as a sort of portable assembly language, is frequently the target language of such compilers. For example, [[Cfront]], the original compiler for [[C++]], used C as its target language. The C code generated by such a compiler is usually not intended to be readable and maintained by humans, so [[indent style]] and creating pretty C intermediate code are ignored. Some of the features of C that make it a good target language include the [[C preprocessor#Special macros and directives|<code>#line</code>]] directive, which can be generated by the compiler to support [[debugging]] of the original source, and the wide platform support available with C compilers. While a common compiler type outputs machine code, there are many other types: * [[Source-to-source compiler]]s are a type of compiler that takes a high-level language as its input and outputs a high-level language. For example, an [[Automatic parallelization|automatic parallelizing]] compiler will frequently take in a high-level language program as an input and then transform the code and annotate it with parallel code annotations (e.g. [[OpenMP]]) or language constructs (e.g. Fortran's <code>DOALL</code> statements). Other terms for a source-to-source compiler are transcompiler or transpiler.<ref>{{cite journal |last1=Ilyushin |first1=Evgeniy |last2=Namiot |first2=Dmitry |date=2016 |title=On source-to-source compilers |url=https://cyberleninka.ru/article/n/on-source-to-source-compilers/pdf |journal=International Journal of Open Information Technologies |volume=4 |issue=5 |pages=48β51 |archive-url=https://web.archive.org/web/20220913223759/https://cyberleninka.ru/article/n/on-source-to-source-compilers/pdf |archive-date=13 September 2022 |access-date=September 14, 2022}}</ref> * [[Bytecode]] compilers compile to assembly language of a theoretical machine, like some [[Prolog]] implementations ** This Prolog machine is also known as the [[Warren Abstract Machine]] (or WAM). ** Bytecode compilers for [[Java (programming language)|Java]], [[Python (programming language)|Python]] are also examples of this category. * [[Just-in-time compilation|Just-in-time compilers]] (JIT compiler) defer compilation until runtime. JIT compilers exist for many modern languages including [[Python (programming language)|Python]], [[JavaScript]], [[Smalltalk]], [[Java (programming language)|Java]], Microsoft [[.NET Framework|.NET]]'s [[Common Intermediate Language]] (CIL) and others. A JIT compiler generally runs inside an interpreter. When the interpreter detects that a code path is "hot", meaning it is executed frequently, the JIT compiler will be invoked and compile the "hot" code for increased performance. ** For some languages, such as Java, applications are first compiled using a bytecode compiler and delivered in a machine-independent [[intermediate representation]]. A bytecode interpreter executes the bytecode, but the JIT compiler will translate the bytecode to machine code when increased performance is necessary.<ref>{{cite journal |author-last=Aycock |author-first=John |date=2003 |title=A Brief History of Just-in-Time |journal=ACM Comput. Surv. |volume=35 |issue=2 |pages=93β113 |doi=10.1145/857076.857077 |s2cid=15345671}}</ref>{{primary source inline|date=March 2017}} * [[silicon compiler|Hardware compilers]] (also known as synthesis tools) are compilers whose input is a [[hardware description language]] and whose output is a description, in the form of a [[netlist]] or otherwise, of a hardware configuration. ** The output of these compilers target [[computer hardware]] at a very low level, for example a [[field-programmable gate array]] (FPGA) or structured [[application-specific integrated circuit]] (ASIC).<ref>{{cite book|last1=Swartz|first1=Jordan S.|last2=Betz |first2=Vaugh |last3 =Rose|first3=Jonathan|title=Proceedings of the 1998 ACM/SIGDA sixth international symposium on Field programmable gate arrays - FPGA '98 |chapter=A fast routability-driven router for FPGAs |location=Monterey, CA|publisher=[[Association for Computing Machinery|ACM]]|chapter-url= http://www.eecg.toronto.edu/~vaughn/papers/fpga98.pdf |url-status=live|archive-url=https://web.archive.org/web/20170809012611/http://www.eecg.toronto.edu/~vaughn/papers/fpga98.pdf|archive-date=9 August 2017|date =22-25 February 1998|doi = 10.1145/275107.275134 |pages=140β149|isbn=978-0897919784|s2cid=7128364}}</ref>{{primary source inline|date=March 2017}} Such compilers are said to be hardware compilers, because the source code they compile effectively controls the final configuration of the hardware and how it operates. The output of the compilation is only an interconnection of [[transistor]]s or [[lookup table]]s. ** An example of hardware compiler is XST, the Xilinx Synthesis Tool used for configuring FPGAs.<ref>{{cite web|author=Xilinx Staff|date=2009|title=XST Synthesis Overview|publisher=Xilinx, Inc.|url=http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/ise_c_using_xst_for_synthesis.htm|access-date=28 February 2017|url-status=live|archive-url=https://web.archive.org/web/20161102004019/http://www.xilinx.com/support/documentation/sw_manuals/xilinx11/ise_c_using_xst_for_synthesis.htm|archive-date=2 November 2016}}</ref>{{primary source inline|date=March 2017}} Similar tools are available from Altera,<ref>{{cite web|author=Altera Staff|date=2017|title=Spectra-Qβ’ Engine|publisher=Altera.com|url=https://www.altera.com/products/design-software/fpga-design/quartus-prime/features/spectra-q.html|access-date=28 February 2017|url-status=dead|archive-url=https://web.archive.org/web/20161010221724/https://www.altera.com/products/design-software/fpga-design/quartus-prime/features/spectra-q.html|archive-date=10 October 2016}}</ref>{{primary source inline|date=March 2017}} Synplicity, Synopsys and other hardware vendors.{{citation needed|date=March 2017}} ** Research systems compile subsets of high level serial languages, such as Python or C++, directly into parallelized digital logic. This is typically easier to do for functional languages or functional subsets of multi-paradigm languages.<ref>{{cite conference |last1=Jurkans |first1=K |last2=Fox |first2=C |title=Python Subset to Digital Logic Dataflow Compiler for Robots and IoT |conference=IEEE International Conference on Trust, Security and Privacy in Computing and Communications (TrustCom-2023) |year=2023}}</ref> * A program that translates from a low-level language to a higher level one is a [[decompiler]].<ref>{{cite book |doi=10.1016/B978-1-59749-574-5.00003-9 |chapter=Tools of the Trade |title=Managed Code Rootkits |date=2011 |last1=Metula |first1=Erez |pages=39β62 |isbn=978-1-59749-574-5 }}</ref> * A program that translates into an object code format that is not supported on the compilation machine is called a [[cross compiler]] and is commonly used to prepare code for execution on embedded software applications.<ref>{{Cite web |last=Chandrasekaran |first=Siddharth |date=2018-01-26 |title=Cross Compilation Demystified |url=https://embedjournal.com/cross-compilation-demystified/ |access-date=2023-03-05 |website=embedjournal.com |language=en}}</ref>{{better source needed|date=March 2023}} * A program that rewrites object code back into the same type of object code while applying optimisations and transformations is a [[binary recompiler]]. ''Assemblers,'' which translate human readable [[assembly language]] to the [[machine code]] instructions executed by hardware, are not considered compilers.<ref>Calingaert and Horowitz 1979, pp. 186-187</ref>{{efn|"The many source-language features described in the preceding section result in a number of salient differences between compilers and assemblers. On any one item the distinction may not be clear-cut. Moreover, it may be difficult to distinguish a simple compiler from a powerful macro assembler. Nevertheless, the differences are usually substantial enough that there remains a qualitative distinction between assemblers and compilers."}} (The inverse program that translates machine code to assembly language is called a [[disassembler]].)
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)