Rozpach

Rozpach is an esoteric programming language invented in 2022 by User:PoetLuchnik with the goal of being function-only programming language. Code is a list of function definitions. And there are only two operations: push a function or argument onto the stack and pop the function from the stack and call it.
==Language overview==
A Rozpach program is a list of function definitions. A function definition starts with the name of the function, then comes the list of arguments, which ends with a dot, followed by the body of the function, which ends with a semicolon. The argument list and function body can be empty. All identifiers must be separated by white space characters. For example a minimal program looks like this:
 F . ;
Rozpach programs store data on the stack, but language has no data except functions (function pointers). To push a function onto the stack, simply write its name:
 F . A B ;
This function pushes two functions onto the stack. First A then B. To pop and call a function use a dot in the body of the function:
 F . A . ;
This function calls A. Argument values are popped off the stack in reverse order. This means that you don't have to pass values in reverse order yourself, as you would in assembly languages. To push an argument value onto the stack, simply write its name:
 F . A B R . S . ;
 R a b . a b ;
 S a b . b a ;
The R function does not change anything, but the S function swaps two values. The arguments a and b store the values of A and B, respectively. When there is a name collision, the arguments are used first:
 dup dup . dup dup ;
The dup function pushes the value of the argument onto the stack twice. You can name a function with a dot or a semicolon, but it cannot be placed on the stack and therefore cannot be called.
 . . ;
 ; . ;
You can name a function argument with a semicolon, but you can't get its value.
 F ; . ;
Multiple arguments can have the same name, the first one will be used to get the value.
 F . A B G . ;
 G a a . a ;
The G function takes two arguments and pushes the value of the first argument onto the stack.
===Implementation dependent===
* The input and output functions are implementation dependent
* What happens when a program pops an empty stack is implementation dependent
* The name of the main function is implementation dependent
* There are no limitation on the implementation of external functions
===EBNF===
 program = [ ws ] , fn , { fn } ;
 (* function = name , arguments , "." , body , ";" *)
 fn = id , ws , { id , ws } , "." , ws , { id , ws } , ";" , ws ;
 ws = ? white space characters ? ;
 id = ? non white space characters ? ;
===Etymology===
The word "rozpach" in translation from Ukrainian means "despair" and pronounced /ROZ-pahch/.
==Examples==
===TinyRozpach===
====Hello, World!====
 main .
 F T F F T F F F put .
 F T T F F T F T put .
 F T T F T T F F put .
 F T T F T T F F put .
 F T T F T T T T put .
 F F T F T T F F put .
 F F T F F F F F put .
 F T F T F T T T put .
 F T T F T T T T put .
 F T T T F F T F put .
 F T T F T T F F put .
 F T T F F T F F put .
 F F T F F F F T put .
 ;
 T a b . a ;
 F a b . b ;
====Truth-machine====
 main . get . loop . ;
 loop a . 0 0 1 1 0 0 0 a put . a loop 1 a . . ;
 0 a b . b ;
 1 b . ;
====Cat program====
 stop . ;
 or a b . b a b . ;
 or8 . or . or . or . or . or . or . or . ;
 copy8 1 2 3 4 5 6 7 8 . 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 ;
 main . main stop get . copy8 . put . or8 . . . ;
====Increment====
 _ . ;
 T B . ;
 F A B . B ;
 \n . F F F F T F T F put . ;
 p1 A . F F T T F F F A put . ;
 put8 . p1 . p1 . p1 . p1 . p1 . p1 . p1 . p1 . \n . ;
 cpy8 1 2 3 4 5 6 7 8 . 1 2 3 4 5 6 7 8 1 2 3 4 5 6 7 8 ;
 + A B . F T B . B A . B A A . ;
 ++ 0 1 2 3 4 5 6 7 .
 T 0 + . 1 + . 2 + . 3 + . 4 + . 5 + . 6 + . 7 + . ;
 shuffle C A B . A B C ;
 loop . cpy8 . put8 . ++ . _ loop shuffle . . . ;
 main . F F F F F F F F loop . ;
====99 bottles of beer====
 d0 0 1 2 3 4 5 6 7 8 9 . 0 ;
 d1 0 1 2 3 4 5 6 7 8 9 . 1 ;
 d2 0 1 2 3 4 5 6 7 8 9 . 2 ;
 d3 0 1 2 3 4 5 6 7 8 9 . 3 ;
 d4 0 1 2 3 4 5 6 7 8 9 . 4 ;
 d5 0 1 2 3 4 5 6 7 8 9 . 5 ;
 d6 0 1 2 3 4 5 6 7 8 9 . 6 ;
 d7 0 1 2 3 4 5 6 7 8 9 . 7 ;
 d8 0 1 2 3 4 5 6 7 8 9 . 8 ;
 d9 0 1 2 3 4 5 6 7 8 9 . 9 ;
 d-- A . d9 d0 d1 d2 d3 d4 d5 d6 d7 d8 A . ;
 _ . ;
 n-- A B . A d-- _ _ _ _ _ _ _ _ _ B . . B d-- . ;
 dput A . '0 '1 '2 '3 '4 '5 '6 '7 '8 '9 A . . ;
 nput A B . A dput . B dput . ;
 F A B . B ;
 T B . ;
 '0 . F F T T F F F F put . ;
 '1 . F F T T F F F T put . ;
 '2 . F F T T F F T F put . ;
 '3 . F F T T F F T T put . ;
 '4 . F F T T F T F F put . ;
 '5 . F F T T F T F T put . ;
 '6 . F F T T F T T F put . ;
 '7 . F F T T F T T T put . ;
 '8 . F F T T T F F F put . ;
 '9 . F F T T T F F T put . ;
 '\n . F F F F T F T F put . ;
 'a . F T T F F F F T put . ;
 'b . F T T F F F T F put . ;
 'c . F T T F F F T T put . ;
 'd . F T T F F T F F put . ;
 'e . F T T F F T F T put . ;
 'f . F T T F F T T F put . ;
 'g . F T T F F T T T put . ;
 'h . F T T F T F F F put . ;
 'i . F T T F T F F T put . ;
 'j . F T T F T F T F put . ;
 'k . F T T F T F T T put . ;
 'l . F T T F T T F F put . ;
 'm . F T T F T T F T put . ;
 'n . F T T F T T T F put . ;
 'o . F T T F T T T T put . ;
 'p . F T T T F F F F put . ;
 'q . F T T T F F F T put . ;
 'r . F T T T F F T F put . ;
 's . F T T T F F T T put . ;
 't . F T T T F T F F put . ;
 'u . F T T T F T F T put . ;
 'v . F T T T F T T F put . ;
 'w . F T T T F T T T put . ;
 'x . F T T T T F F F put . ;
 'y . F T T T T F F T put . ;
 'z . F T T T T F T F put . ;
 '. . F F T F T T T F put . ;
 ', . F F T F T T F F put . ;
 '__ . F F T F F F F F put . ;
 'T . F T F T F T F F put . ;
 'N . F T F F T T T F put . ;
 main . d9 d9 beta . d9 d8 loop . gama . ;
 copy2 1 2 . 1 2 1 2 ;
 loop . copy2 . copy2 . alpha . beta . n-- . copy2 . n==0 . loop-end? . . ;
 loop-end? A . _ loop A . ;
 n==0 A B . A d==0 . B d==0 . and . ;
 d==0 A . T F F F F F F F F F A . ;
 and A B . B F A . ;
 bottles_of_beer .
 '__ . 'b . 'o . 't . 't . 'l . 'e . 's . '__ . 'o . 'f . '__ . 'b . 'e . 'e . 'r . ;
 alpha A B . Take_one_down,_pass_it_around, . A B nput . bottles_of_beer . '__ .
 'o . 'n . '__ . 't . 'h . 'e . '__ . 'w . 'a . 'l . 'l . '. . '\n . '\n . ;
 beta A B . A B nput . bottles_of_beer . '__ . 'o . 'n . '__ . 't . 'h . 'e . '__ .
 'w . 'a . 'l . 'l . ', . '\n . A B nput . bottles_of_beer . '. . '\n . ;
 gama . Take_one_down,_pass_it_around, . 'N . 'o . bottles_of_beer . '__ .
 'o . 'n . '__ . 't . 'h . 'e . '__ . 'w . 'a . 'l . 'l . '. . ;
 Take_one_down,_pass_it_around, .
 'T . 'a . 'k . 'e . '__ . 'o . 'n . 'e . '__ . 'd . 'o . 'w . 'n . ', . '__ .
 'p . 'a . 's . 's . '__ . 'i . 't . '__ . 'a . 'r . 'o . 'u . 'n . 'd . ', . '\n . ;
====Triangle====
 _ . ;
 T B . ;
 F A B . B ;
 pop4 1 2 3 4 . ;
 main . F F F F loop1 . ;
 copy4 1 2 3 4 . 1 2 3 4 1 2 3 4 ;
 inc 1 2 3 4 . T 1 add . 2 add . 3 add . 4 add . ;
 add A B . F T B . B A . B F A . ;
 loop1 . copy4 . loop2 . \n . inc . pop4 loop1 shuffle . . . ;
 loop2 . * . inc . pop4 loop2 shuffle . . . ;
 * . F F T F T F T F put . ;
 \n . F F F F T F T F put . ;
 shuffle C A B . A B C ;
==Implementation==
===Interpreters===
====TinyRozpach====
TinyRozpach is a Rozpach interpreter written in JavaScript. Implementation features:
* the main function is the entry point to the program
* the get and put functions allow input and output of ASCII characters, respectively.
* the ASCII character code is stored on the stack as a sequence of 8 bit functions to look like a binary code.
* a bit function definition looks like this:
 1 a b . a ;
 0 a b . b ;
* attempting to pop a value from an empty stack will result in a function with properties equivalent to function 0.
Category:High-level 
Category:Stack-based 
Category:Implemented 
Category:Languages
Category:2022
Category:Turing complete