Source code: Difference between revisions
Ilyagredasov (talk | contribs) No edit summary Tags: Mobile edit Mobile web edit |
Ilyagredasov (talk | contribs) No edit summary Tags: Mobile edit Mobile web edit |
||
| Line 1: | Line 1: | ||
'''Source code''' is a collection of text files containing instructions that a computer either runs as-is (interpretation) or translates into an executable file beforehand (compilation / assembly). Source code is written using a human-readable computer language so that it can be translated by a compiler or an interpreter. It's also possible to decompile an executable file, though decompilers aren't as common. | '''Source code''' is a collection of text files containing instructions that a computer either runs as-is (interpretation) or translates into an executable file beforehand (compilation/assembly). Source code is written using a human-readable computer language so that it can be translated by a compiler or an interpreter. It's also possible to decompile an executable file, though decompilers aren't as common. | ||
The language used changes how the source code is read, and just like emulation it too has its own high and low-level types. If a program were written in an assembly language (which often involves taking advantage of system-specific attributes), an assembler would write the machine code "word for word," reflecting how the machine takes instructions. If a program were written in a low-level language, a compiler would read the code and translate the equivalent in machine code. If a program were written in a high-level language, it would often work without requiring a compiler. Some compilers and interpreters also do error checking to make sure the programmer's code is either properly written or formatted. Many languages also check that the code won't inherently cause bugs, such as Rust. | The language used changes how the source code is read, and just like emulation it too has its own high and low-level types. If a program were written in an assembly language (which often involves taking advantage of system-specific attributes), an assembler would write the machine code "word for word," reflecting how the machine takes instructions. If a program were written in a low-level language, a compiler would read the code and translate the equivalent in machine code. If a program were written in a high-level language, it would often work without requiring a compiler. Some compilers and interpreters also do error checking to make sure the programmer's code is either properly written or formatted. Many languages also check that the code won't inherently cause bugs, such as Rust. | ||
| Line 20: | Line 20: | ||
===High=== | ===High=== | ||
High-level languages push away most system specific quirks in favor of instructions intended to work on any platform. This was pioneered by Java, whose goal was for developers to "write once, run anywhere". | High-level languages push away most system-specific quirks in favor of instructions intended to work on any platform. This was pioneered by Java, whose goal was for developers to "write once, run anywhere". | ||
In high-level languages, many of the same instructions can be run across different architectures and platforms. They may have a compiler, a compiler cache, a [[dynamic recompilation|dynamic recompiler]], and/or an interpreter. | In high-level languages, many of the same instructions can be run across different architectures and platforms. They may have a compiler, a compiler cache, a [[dynamic recompilation|dynamic recompiler]], and/or an interpreter. | ||