Content deleted Content added
I am not a childish don't know why do I have parental controls Tags: Reverted references removed Visual edit Mobile edit Mobile web edit |
m Reverted edit by 102.219.27.151 (talk) to last version by Frost |
||
Line 1:
{{Short description|Instructions a computer can execute}}
{{for|the TV program|The Computer Programme{{!}}''The Computer Programme''}}
[[File:JavaScript_code.png|thumb|[[Source code]] for a computer program written in the [[JavaScript]] language. It demonstrates the ''appendChild'' method. The method adds a new child node to an existing parent node. It is commonly used to dynamically modify the structure of an HTML document.]]
A '''computer program''' is a sequence or set of instructions in a programming language for a computer to execute. It is one component of software, which also includes documentation and other intangible components.▼
{{Program execution}}
▲A '''computer program''' is a [[sequence]] or set{{efn|The [[Prolog]] language allows for a database of facts and rules to be entered in any order. However, a question about a database must be at the very end.}} of instructions in a [[programming language]] for a [[computer]] to [[Execution (computing)|execute]]. It is one component of [[software]], which also includes [[software documentation|documentation]] and other intangible components.<ref name="ISO 2020">{{cite web
| title=ISO/IEC 2382:2015
| website=ISO
| date=2020-09-03
| url=https://www.iso.org/obp/ui/#iso:std:iso-iec:2382:ed-1:v1:en
| access-date=2022-05-26
| quote=[Software includes] all or part of the programs, procedures, rules, and associated documentation of an information processing system.
| archive-date=2016-06-17
| archive-url=https://web.archive.org/web/20160617031837/https://www.iso.org/obp/ui/#iso:std:iso-iec:2382:ed-1:v1:en
| url-status=live
}}</ref>
A ''computer program'' in its [[Human-readable medium and data|human-readable]] form is called [[source code]]. Source code needs another computer program to [[Execution (computing)|execute]] because computers can only execute their native [[machine code|machine instructions]]. Therefore, source code may be [[Translator (computing)|translated]] to machine instructions using a [[compiler]] written for the language. ([[Assembly language]] programs are translated using an [[Assembler (computing)|assembler]].) The resulting file is called an [[executable]]. Alternatively, source code may execute within an [[interpreter (computing)|interpreter]] written for the language.<ref name="cpl_3rd-ch1-7_quoted">{{cite book
| last = Wilson
| first = Leslie B.
| title = Comparative Programming Languages, Third Edition
| publisher = Addison-Wesley
| year = 2001
| page = 7
| quote = An alternative to compiling a source program is to use an interpreter. An interpreter can directly execute a source program[.]
| isbn = 0-201-71012-9
}}</ref>
If the executable is requested for execution, then the [[operating system]] [[Loader (computing)|loads]] it into [[Random-access memory|memory]] and starts a [[Process (computing)|process]].<ref
| last = Silberschatz
| first = Abraham
| title = Operating System Concepts, Fourth Edition
| publisher = Addison-Wesley
| year = 1994
| page = 98
| isbn = 978-0-201-50480-4
}}</ref> The [[central processing unit]] will soon [[Context switch|switch]] to this process so it can [[Instruction cycle|fetch, decode, and then execute]] each machine instruction.<ref name="sco-ch2-p32">{{cite book
| last = Tanenbaum
| first = Andrew S.
| title = Structured Computer Organization, Third Edition
| publisher = Prentice Hall
| year = 1990
| page = [https://archive.org/details/structuredcomput00tane/page/32 32]
| isbn = 978-0-13-854662-5
| url = https://archive.org/details/structuredcomput00tane/page/32
}}</ref>
If the source code is requested for execution, then the operating system loads the corresponding interpreter into memory and starts a process. The interpreter then loads the source code into memory to translate and execute each [[Statement (computer science)|statement]]. Running the source code is slower than running an [[executable]].<ref
| first = Leslie B.
| title = Comparative Programming Languages, Third Edition
| publisher = Addison-Wesley
| year = 2001
| page = 7
| isbn = 0-201-71012-9
}}</ref>{{efn|An executable has each [[machine instruction]] ready for the [[CPU]].}} Moreover, the interpreter must be installed on the computer.
==Example computer program==
|