# Programming Language

Programming language is an artificial [formal](formal.md) (mathematically precise) [language](formal_language.md) created in order to allow humans to relatively easily write [algorithms](algorithm.md) for [computers](computer.md). It allows a human to very specifically and precisely tell computer what to do. Such language often tries to mimic human language (practically always [English](english.md)) so as to be somewhat close to humans but is also much MUCH simpler so that a computer can actually analyze it and understand it precisely, without ambiguity, so in the end it 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).

For beginners: a programming language is actually much easier to learn than a foreign language, 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.

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). This is to say that 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.

We divide programming languages into different groups. Perhaps the most common divisions is to two groups:

- **compiled** languages: Meant to be transformed by a [compiler](compiler.md) to a [native](native.md) (directly executable) binary program, i.e. before running the program we have to run it through the process of compilation into runnable form. These languages are typically more efficient but usually more difficult to program in, less flexible and the compiled programs are non-portable (can't just be copy-pasted to another computer with different [architecture](isa.md) and expected to run; note that this doesn't mean compiled languages aren't [portable](portability.md), just that the compiled EXECUTABLE is not). These languages are usually [lower level](low-level), use static and strong [typing](typing.md) and more of manual [memory management](memory_management.md). Examples: [C](c.md), [C++](cpp.md), [go](go.md), [Haskell](haskell.md) or [Pascal](pascal.md).
- **interpreted** languages: Meant to be interpreted by an [interpreter](interpreter.md) "on-the-go", i.e. what we write we can also immediately run. To run such program you need the interpreter of the language installed on your computer and this interpreter reads the [source code](source_code.md) as it is written and performs what it dictates (well, this is actually simplified as the interpreter normally also internally does a kind of quick "lightweight" compilation, but anyway...). These languages are generally less efficient (slower, use more RAM) but also more flexible, easier to program in and [independent of platforms](platform_independent.md). These languages usually [higher-level](high_level.md), use weak and dynamic [typing](typing.md) and automatic [memory management](memory_management.md) ([garbage collection](garbage_collection.md), ...). Examples: [Python](python.md), [Perl](perl.md), [JavaScript](js.md) and [BASH](bash.md).

Sometimes the distinction here may not be completely clear, for example Python is normally considered an interpreted language but it can also be compiled into [bytecode](bytecode.md) and even native code. [Java](java.md) is considered more of a compiled language but it doesn't compile to native code (it compiles to bytecode). [C](c.md) is traditionally a compiled language but there also exist C interpreters. [Comun](comun.md) is meant to be both compiled and interpreted etc.

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), level of **[abstraction](abstraction.md)** (high, low), [typing](data_type.md) (strong, weak, dynamic, static) or function evaluation (strict, lazy).

A computer language consists from 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)**: 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.

## Notable Languages

Here is a table of notable programming languages in chronological order (keep in mind a language usually has several versions/standards/implementations, this is just an overview).

| language                | minimalist/good? | since | notes                                                                  |
| ----------------------- | ---------------- | ----- | ---------------------------------------------------------------------- |
|"[assembly](assembly.md)"| **yes** but...   | 1947? | NOT a single language, non-[portable](portability.md)                  |
|[Fortran](fortran.md)    | **kind of**      | 1957  | similar to Pascal, compiled, fast, was used by scientists a lot        |
| [Lisp](list.md)         | **yes**          | 1958  | elegant, KISS, functional, many variants (Common Lisp, Closure, ...)   |
| [Basic](basic.md)       | kind of?         | 1964  | mean both for beginners and professionals, probably efficient          |
| [Forth](forth.md)       | **yes**          | 1970  | [stack](stack.md)-based, elegant, very KISS, interpreted and compiled  |
| [Pascal](pascal.md)     | **kind of**      | 1970  | like "educational C", compiled, not so bad actually                    |
| **[C](c.md)**           | **kind of**      | 1972  |compiled, fastest, efficient, established, suckless, low-level, #1 lang.|
| [Prolog](prolog.md)     | maybe?           | 1972  | [logic](logic.md) paradigm, hard to learn/use                          |
|[Smalltalk](smalltalk.md)| looks like yes?  | 1972  | PURE [OOP](oop.md) language, probably not as corrupt as C++/Java/...   |
| [C++](cpp.md)           | no, bearable     | 1982  |bastard child of C, only adds [bloat](bloat.md) ([OOP](oop.md)), "games"|
| [Ada](ada.md)           | ???              | 1983  | { No idea about this, sorry. ~drummyfish }                             |
| Object Pascal           | no               | 1986  | Pascal with OOP (like what C++ is to C), i.e. only adds bloat          |
| Objective-C             | probably not     | 1986  | kind of C with Smalltalk-style "pure" objects?                         |
| [Perl](perl.md)         | rather not       | 1987  | interpreted, focused onstrings, has kinda cult following               |
| [Bash](bash.md)         | well             | 1989  | Unix scripting shell, very ugly syntax, not so elegant but bearable    |
|[Haskell](haskell.md)    | **kind of**      | 1990  | [functional](functional.md), compiled, acceptable                      |
|[Python](python.md)      | NO               | 1991  | interpreted, huge bloat, slow, lightweight OOP, artificial obsolescence|
|[Brainfuck](brainfuck.md)| **yes**          | 1993  | extremely minimal (8 commands), hard to use, [esolang](esolang.md)     |
| [Lua](lua.md)           | **kind of**      | 1993  | interpreted, mainly for scripting (used a lot in games)                |
| [Java](java.md)         | NO               | 1995  | forced [OOP](oop.md), "platform independent" (bytecode), slow, bloat   |
| [JavaScript](js.md)     | NO               | 1995  | interpreted, the [web](web.md) lang., bloated, classless [OOP](oop.md) |
| [PHP](php.md)           | no               | 1995  | server-side web lang., OOP                                             |
| [Ruby](ruby.md)         | no               | 1995  | similar to Python                                                      |
| [C#](c_sharp.md)        | NO               | 2000  | proprietary (yes it is), extremely bad lang. owned by Micro$oft, AVOID |
| [D](d.md)               | no               | 2001  | some expansion/rework of C++? OOP, generics etcetc.                    |
| [Rust](rust.md)         | NO! lol          | 2006  |extremely bad, slow, freedom issues, toxic community, no standard, AVOID|
| [Go](go.md)             | **kind of**      | 2009  | "successor to C" but not well executed, bearable but rather avoid      |
| [LIL](lil.md)           | **yes**          | 2010? | not known too much but nice, "everything's a string"                   |
| **[comun](comun.md)**   | **yes**          | 2022  | "official" [LRS](lrs.md) language, WIP, similar to Forth               |

## Interesting Programming Languages

Some programming languages may be [interesting](interesting.md) rather than directly useful, however they teach us a lot and may help us design good practically usable languages. In fact professional researches in theory of computation spend their whole lives dealing with such languages.

One such language is e.g. **[Unary](unary_lang.md)**, a programming language that only uses a single character while being Turing complete (i.e. having the highest possible "computing power", being able to express any program). All programs in Unary are just sequences of one character, differing only by their length (i.e. a program can also be seen just as a single natural number, the length of the sequence). We can do this because we can make an ordered list of all (infinitely many) possible programs in some simple programming language (such as a [Turing machine](turing_machine.md) or [Brainfuck](brainfuck.md)), i.e. assign each program its ordinal number (1st, 2nd, 3rd, ...) -- then to express a program we simply say the position of the program on the list.

There is a community around so called **[esoteric programming languages](esolang.md)** which takes great interest in such languages, from mere [jokes](jokes.md) (e.g. languages that look like cooking recipes or languages that can compute everything but can't output anything) to discussing semi-serious and serious, even philosophical and metaphysical questions. If you dare, kindly follow the rabbit hole.

## See Also

- [esoteric programming language](esolang.md)
- [constructed language](conlang.md)
- [compiler](compiler.md)
