Comun

   Comun is a [1]beautiful, greatly [2]minimalist [3]programming language
   made by [4]drummyfish in 2022, based on his ideals of good, [5]selfless
   [6]technology known as [7]less retarded software (LRS), of which it is now
   considered the official programming language, though still a greatly work
   in progress one. In the future it should gradually replace [8]C as the
   preferred LRS language, however let's keep in mind the language is still
   highly experimental and work in progress, it may yet change more or less.
   The language has been inspired mainly by [9]Forth but also [10]C,
   [11]brainfuck and other ones. Though already usable, it is still in
   development; currently there is a [12]suckless implementation of comun in
   [13]C as well as a basic [14]self hosted one which should gradually
   replace the C version. There is also a number of supplemental materials
   such as a specification, tutorial and some example programs. The project
   repository is currently at https://codeberg.org/drummyfish/comun. The aim
   now is to make a [15]self hosted implementation, i.e. write comun in
   comun. Though very young, comun is probably already the best programming
   language ever conceived :-)

   How minimal is comun? The specification fits on one sheet of A4 paper
   (using both sides) and the minimal self hosted compiler without
   preprocessor and fancy features has some 2400 [16]lines of code, a lot of
   which are documenting comments (the whole self hosted codebase that also
   includes a more "feature rich" compiler, optimizer, interpreter etc. still
   has fewer than 5000 lines).

   { NOTE: I found a language on esolang wiki called Minim that looks a bit
   similar to comun, however it looks a bit sucky. Anyway it should be
   researched more. ~drummyfish }

   The language is intended to be the foundation of a completely new,
   non-[17]capitalist computer technology built from the ground up, which
   should culminate in the creation of the LRS much desired [18]public domain
   computer. This technology is derived from the model of an [19]ideal
   society and as such will aim for completely different goals (such as
   helping all living beings as much as possible without enslaving them) and
   values; this makes comun astronomically different in philosophy and design
   of the shitty, toxic capitalist joke languages such as [20]C++ and
   [21]Rust which pursue fascism, enslavement of humans to the
   [22]productivity cult etc.

   Comun is planned to closely interact with [23]comun shell, though the two
   parts will be completely independent.

   A quick sum up is following: comun is [24]minimalist, [25]low level with
   minimum [26]abstraction, [27]portable, [28]imperative and [29]stack-based,
   using reverse Polish notation. It can be both [30]compiled and
   [31]interpreted. There are only primitive integer [32]data types (native
   integer size by default with possibility to specify exact width where
   necessary, signed/unsigned interpretation is left to the programmer) and
   optional [33]pointers that can be used as variables, for managing multiple
   stacks, creating [34]arrays etc. Its specification can fit on a sheet of
   paper and is completely [35]public domain under [36]CC0 (as is its current
   implementation). It has no [37]standard library. There are no [38]English
   keywords; commands are rather very short (mostly 1 to three symbols)
   math-like symbols. Source code only allows [39]ASCII symbols (no
   [40]unicode). There is an optional [41]preprocessor that uses comun itself
   (i.e. it doesn't use any extra language). [42]Functions and [43]recursion
   are supported. Many features of the language are optional and never burden
   the programmer if he doesn't use them. Simplified versions of the language
   (minicomun and microcomun) are also specified.

Examples

   Here is a very short showcase of comun code, demonstrating some common
   functions:

 max: <' ? >< . ^ .      # takes maximum of two values

 max3: max max .         # takes maximum of three values

 # recursive factorial
 factR:
   ?'
     $0 -- factR *
   ;
     ^ 1
   .
 .

 # iterative factorial
 factI:
   $0 --

   @'
     >< $1 * ><
     --
   .
   ^
 .

   The following is a [44]quine in comun:

 0 46 32 34 S 34 32 58 83 S --> S: "0 46 32 34 S 34 32 58 83 S --> " .

   The following code translates [45]brainfuck to comun (proving comun really
   is [46]Turing complete):

 0 "$>0 " -->

 @@
   <? ?
     <-

     $0 "+" = $1 "-" = | ?
       $0 -> $0 -> " " ->
     .

     $0 "<" = $1 ">" = | ?
       "$" -> $0 -> "0" -> " " ->
     .

     $0 "." = ?
       0 "->' " -->
     .

     $0 "," = ?
       0 "$<0 <- " -->
     .

     $0 91 = ? # left bracket
       0 "@' " -->
     .

     $0 93 = ? # right bracker
       0 ". " -->
     .

     ^
   ;
     !@
   .
 .

   TODO: more, code examples, compare the above with C, ...

See Also

     * [47]comun shell
     * [48]MIX
     * [49]uxn
     * [50]minim
     * [51]Oberon

Links:
1. beauty.md
2. minimalism.md
3. programming_language.md
4. drummyfish.md
5. selflessness.md
6. technology.md
7. lrs.md
8. c.md
9. forth.md
10. c.md
11. brainfuck.md
12. suckless.md
13. c.md
14. self_hosting.md
15. self_hosting.md
16. loc.md
17. capitalism.md
18. public_domain_computer.md
19. less_retarded_society.md
20. cpp.md
21. rust.md
22. productivity_cult.md
23. comun_shell.md
24. minimalism.md
25. low_level.md
26. abstraction.md
27. portability.md
28. imperative.md
29. stack.md
30. compiler.md
31. interpreter.md
32. data_type.md
33. pointer.md
34. array.md
35. public_domain.md
36. cc0.md
37. stdlib.md
38. english.md
39. ascii.md
40. unicode.md
41. preprocessor.md
42. function.md
43. recursion.md
44. quine.md
45. brainfuck.md
46. turing_complete.md
47. comun_shell.md
48. mix.md
49. uxn.md
50. minim.md
51. oberon.md