Update
This commit is contained in:
parent
580a061146
commit
d8966a5bab
20 changed files with 1933 additions and 1891 deletions
|
@ -1,8 +1,8 @@
|
|||
# Programming Language
|
||||
|
||||
Programming language is an artificial [formal](formal_language.md) (mathematically precise) language created in order to allow humans to relatively easily write [algorithms](algorithm.md) for [computers](computer.md). It basically allows a human to very specifically and precisely but still relatively comfortably tell a computer what to do. We call a program written in programming language the program's **[source code](source_code.md)**. Programming languages often try to mimic some human language -- practically always [English](english.md) -- so as to be somewhat close to humans but programming language is actually MUCH simpler so that a computer can actually analyze it and understand it precisely (as computers are extremely bad at understanding actual [human language](human_language.md)), without ambiguity, so in the end it all also partially looks like [math](math.md) expressions. A programming language can be seen as a middle ground between pure [machine code](machine_code.md) (the computer's native language, very hard to handle by humans) and natural language (very hard to handle by computers).
|
||||
Programming language is an artificial [formal](formal_language.md) (mathematically precise) language created in order to let humans relatively easily write [algorithms](algorithm.md) for [computers](computer.md). Such a language essentially allows a man to very specifically and precisely (but still relatively comfortably) tell a computer what to do by expressing an algorithm in textual form. [Program](program.md) written in a programming language is called the program's **[source code](source_code.md)**. Programming languages often try to mimic [human language](human_language.md) -- practically always [English](english.md) -- so as to be somewhat close to humans but programming language is actually MUCH simpler so that a computer can actually analyze it and understand it precisely, as understanding natural human languages poses great difficulty to computers, so in the end programming languages also partially resemble [math](math.md) expressions. Programming languages can be seen as a middle ground between pure [machine code](machine_code.md) (the computer's native language, very hard to handle by humans) and natural language (very hard to handle by computers).
|
||||
|
||||
For beginners: a programming language is actually much easier to learn than a [foreign language](human_language.md), it will typically have fewer than 100 "words" to learn (out of which you'll mostly use like 10) and once you know one programming language, learning another becomes a breeze because they're all (usually) pretty similar in basic concepts. The hard part may be learning some of the concepts if you encounter them for the first time. This is not to say programming is easy -- it is hard, but not because learning the language would be difficult; learning the language is relatively the easier part of programming, the hard parts are for example designing the program's architecture well, designing good protocols and interfaces, learning the math behind the problems you're solving, creating good mathematical models, optimizing and debugging your program well and so on.
|
||||
For beginners: a programming language is actually much easier to learn than a [foreign language](human_language.md), it will typically have no more than 100 "words" to learn (out of which you'll mostly use like 10) and once you know one programming language, learning another becomes a breeze because they're all (usually) pretty similar in basic concepts. The hard part may be learning some of the concepts if you encounter them for the first time. This is not to say programming is easy -- it is hard, but not because learning the language would be difficult; learning the language is relatively the easier part of programming, the hard parts are for example designing the program's architecture well, designing good protocols and interfaces, learning the math behind the problems you're solving, creating good mathematical models, optimizing and debugging your program well and so on.
|
||||
|
||||
A programming language is distinct from a general computer language by its purpose to express algorithms and be used for creation of [programs](program.md). In other words: there are computer languages that are NOT programming languages (at least in the narrower sense), such as [HTML](html.md), [json](json.md) and so on. So you shouldn't be calling yourself a programmer if you're just manually writing a website in HTML, people will laugh at you.
|
||||
|
||||
|
@ -50,12 +50,12 @@ Another common division is by **level of [abstraction](abstraction.md)** roughly
|
|||
- **[low level](low_level.md)**: Languages which are so called "closer to [hardware](hardware.md)" ("glorified [assembly](assembly.md)"), using little to no abstraction (reflecting more how a computer actually works under the hood without adding too many artificial concepts above it, allowing direct access to memory with [pointers](pointer.md), ...), for this they very often use plain [imperative](imperative.md) paradigm), being less comfortable (requiring the programmer to do many things manually), less flexible, less safe (allowing shooting oneself in the foot). However (because [less is more](less_is_more.md)) they have great many advantages, e.g. being [simple](kiss.md) to implement (and so more [free](freedom.md)) and **greatly efficient** (being fast, memory efficient, ...). One popular definition is also that "a low level language is that which requires paying attention to the irrelevant"; another definition says a low level language is that in which one command usually corresponds to one machine instruction. Low level languages are **typically compiled** (but it doesn't have to be so). Where exactly low level languages end is highly subjective, many say [C](c.md), [Fortran](fortran.md), [Forth](forth.md) and similar languages are low level (normally when discussing them in context of new, very high level languages), others (mainly the older programmers) say only [assembly](assembly.md) languages are low level and some will even say only [machine code](machine_code.md) is low level.
|
||||
- **[high level](high_level.md)**: Languages with higher level of abstraction than low level ones -- they are normally more complex (though not always), interpreted (again, not necessarily), comfortable, dynamically typed, beginner friendly, "safe" (having various safety mechanism, automatic checks, automatic memory management such as [garbage collection](garbage_collection.md)) etc. For all this they are typically slower, less memory efficient, and just more [bloated](bloat.md). Examples are [Python](python.md) or [JavaScript](js.md).
|
||||
|
||||
We can divide language in many more ways, for example based on their **[paradigm](paradigm.md)** (roughly its core idea/model/"philosophy", e.g. [impertaive](imperative.md), [declarative](declarative.md), [object-oriented](oop.md), [functional](functional.md), [logical](logical.md), ...), **purpose** (general purpose, special purpose), computational power ([turing complete](turing_complete.md) or weaker, many definitions of a programming language require Turing completeness), [typing](data_type.md) (strong, weak, dynamic, static) or function evaluation (strict, lazy).
|
||||
It's possible to divide languages in more distinct ways, for instance based on their **[paradigm](paradigm.md)** (roughly its core idea/model/"philosophy", e.g. [impertaive](imperative.md), [declarative](declarative.md), [object-oriented](oop.md), [functional](functional.md), [logical](logical.md), ...), **purpose** (general purpose, special purpose), computational power ([turing complete](turing_complete.md) or weaker, many definitions of a programming language require Turing completeness), [typing](data_type.md) (strong, weak, dynamic, static) or function evaluation (strict, lazy).
|
||||
|
||||
A computer language consists of two main parts:
|
||||
|
||||
- **[syntax](syntax.md)**: The grammar rules and words, i.e. how the language "looks", what expressions we are allowed to write in it. Syntax says which words can follow other words, if indentation has to follow some rules, how to insert comments in the source code, what format numbers can be written in, what kinds of names variables can have etc. Syntax is the surface part, it's often considered not as important or hard as semantics (e.g. syntax errors aren't really a big deal as the language processor immediately catches them and we correct them easily), but a good design of syntax is nevertheless still very important because that's what the programmer actually deals with a great amount of time.
|
||||
- **[semantics](semantics.md)**: The meaning of what we write, i.e. semantics says what the syntax actually stands for. E.g. when syntax says it is possible to write `a / b`, semantics says this means the mathematical operation of division and furthermore specifies what *a* and *b* can actually be, what happens if *b* is zero etc. Semantics is the deeper part as firstly it is more difficult to define and secondly it gives the language its [features](feature.md), its power to compute, usability, it can make the language robust or prone to errors, it can make it efficient or slow, easy and hard to compile, optimize etc.
|
||||
- **[syntax](syntax.md)**: The grammar rules and words, i.e. how the language "looks", what expressions we are allowed to write in it. Syntax says which words can follow other words, if indentation must be present, how to insert comments, what format numbers can be expressed in, what kinds of names variables can have etc. Syntax is the surface part, it's often considered not as important or hard as semantics (e.g. syntax errors aren't really a big deal as the language processor immediately catches them and we correct them easily), but a good syntax design is nonetheless still important because that's what the programmer actually interacts with.
|
||||
- **[semantics](semantics.md)**: The meaning of what we write, i.e. semantics says what the syntax actually stands for, what actions and meaning it expresses. E.g. when syntax says it is possible to write `a / b`, semantics says this means the mathematical operation of division and further specifies what *a* and *b* can actually be, what happens if *b* is zero etc. Semantics is the deeper part as firstly it is more difficult to define and secondly it gives the language its [features](feature.md), its power to compute, usability, it can make the language robust or prone to errors, it can make it efficient or slow, easy and hard to compile, optimize etc.
|
||||
|
||||
We also commonly divide a language to two main parts:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue