This commit is contained in:
Miloslav Ciz 2024-02-04 21:08:42 +01:00
parent 76147e3778
commit 1ae8bf1e9d
10 changed files with 91 additions and 59 deletions

View file

@ -1,6 +1,6 @@
# 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).
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 [natural language](natural_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).
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.
@ -20,41 +20,46 @@ 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.
**What is the best programming language and which one should you learn?** (See also [programming](programming.md).) These are the big questions, the topic of programming languages is infamous for being very [religious](holy_war.md) and different people root for different languages like they do e.g. for [football](football.md) teams. For [minimalists](minimalism.md), i.e. [suckless](suckless.md), [LRS](lrs.md) (us), [Unix](unix.md) people, [Plan9](plan9.md) people etc., the standard language is **[C](c.md)**, which is also probably the most important language in [history](history.md). It is not in the league of the absolutely most minimal and objectively best languages, but it's relatively minimalist (much more than practically any [modern](modern.md) language) and has great advantages such as being one of the absolutely fastest languages, being extremely well established, long tested, supported everywhere, having many compilers etc. But C isn't easy to learn as a first language. Some minimalist also promote [go](golang.md), which is kind of like "new C". Among the most minimal usable languages are traditionally [Forth](forth.md) and [Lisp](lisp.md) which kind of compete for who really is the smallest, then there is also our [comun](comun.md) which is a bit bigger but still much smaller than C. To learn programming you may actually want to start with some ugly language such as [Python](python.md), but you should really aim to transition to a better language later on.
TODO: how to judge minimalism of a language
## 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 |~min. selfhos. impl. LOC | 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 | 100 (judg. by jmc lisp) | 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 |100 (judg. by milliforth)| [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 | 25K (tcc) |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 | 100 (judg. by dbfi) | 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 | 50K (est. from QuickJS) | 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 | < 5K | "official" [LRS](lrs.md) language, WIP, similar to Forth |
| language | minimalist/good? | since |~min. selfhos. impl. LOC |spec. (~no stdlib pages)| 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 | 100 (judg. by jmc lisp) | 1 | 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 |100 (judg. by milliforth)| 1 | [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 | 25K (tcc) | 160, proprietary | 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 | | 500, proprietary | 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 | | 150, proprietary | [functional](functional.md), compiled, acceptable |
|[Python](python.md) | NO | 1991 | | | interpreted, huge bloat, slow, lightweight OOP, artificial obsolescence |
|[Brainfuck](brainfuck.md)| **yes** | 1993 | 100 (judg. by dbfi) | | 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 | 50K (est. from QuickJS) | 500, proprietary? | interpreted, the [web](web.md) lang., bloated, classless [OOP](oop.md) |
| [PHP](php.md) | no | 1995 | | 120 (by Google), CC0 | 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 | | 0 :D | extremely bad, slow, freedom issues, toxic community, no standard, AVOID|
| [Go](go.md) | **kind of** | 2009 | | 130, proprietary? | "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" |
| [uxntal](uxn.md) | **yes** but SJW | 2021 | 400 (official) | 2? (est.), proprietary | assembly lang. for a minimalist virtual machine, PROPRIETARY SPEC. |
| **[comun](comun.md)** | **yes** | 2022 | < 5K | 2, CC0 | "official" [LRS](lrs.md) language, WIP, similar to Forth |
## Interesting Programming Languages