aboutsummaryrefslogtreecommitdiffhomepage
path: root/readme.md
diff options
context:
space:
mode:
Diffstat (limited to 'readme.md')
-rw-r--r--readme.md125
1 files changed, 91 insertions, 34 deletions
diff --git a/readme.md b/readme.md
index 400ab77..c64fd84 100644
--- a/readme.md
+++ b/readme.md
@@ -1,55 +1,112 @@
# Birb
-| bird | term | birb | bird |
-|:-----|:--------------------------|:------------|------------------|
-| πŸͺΆ | c `[[[2 0 1]]]` | cardinal | feather |
-| 🐦 | i `[0]` | idiot | bird |
-| πŸ•ŠοΈ | d `[[[[3 2 (1 0)]]]]` | dove | dove |
-| 🐀 | t `[[0 (1 1 0)]]` | turing | baby chick |
-| πŸ₯ | q’’’ `[[[0 (1 2)]]]` | quacky | front baby chick |
-| 🐣 | Ω `[0 0] [0 0]` | omega | hatching chick |
-| πŸ¦‰ | o `[[0 (1 0)]]` | owl | owl |
-| πŸ” | m `[0 0]` | mockingbird | chicken |
-| πŸ¦† | k `[[1]]` | kestrel | duck |
-| 🦀 | t `[[0 1]]` | thrush | dodo |
-| 🦩 | y `[[1 (0 0)] [1 (0 0)]]` | sage | flamingo |
-| 🦒 | s `[[[2 0 (1 0)]]]` | starling | swan |
-| πŸͺ½ | Ο† `[[[[3 (2 0) (1 0)]]]]` | phoenix | wing |
-| πŸ¦ƒ | w `[[1 0 0]]` | warbler | turkey |
-| πŸ“ | f `[[[0 1 2]]]` | finch | rooster |
-| 🦚 | q `[[[1 (2 0)]]]` | queer | peacock |
-| 🦜 | b `[[[2 (1 0)]]]` | bluebird | parrot |
-| πŸ¦… | e `[[[[[4 3 (2 1 0)]]]]]` | eagle | eagle |
-| 🐧 | ι `[0 s k]` | iota | penguin |
-
-The mappings and their paired reduction are *not* biologically accurate!
-Unfortunately the Unicode team does not have enough bird emojis. Create
-a PR to improve biological accuracy.
+Birb is an *advanced* programming language that only consists of bird
+emojis 🐣. Each emoji gets substituted by a [*combinator
+bird*](https://www.angelfire.com/tx4/cus/combinator/birds.html) of pure
+lambda calculus.
+
+## Birbs
+
+Unfortunately, the Unicode standard does not yet have many
+(single-character) birds. These are the ones currently mapped/supported:
+
+| emoji | animal | combinator | bruijn | term |
+|:-----:|----------------|--------------|---------------------|------------------------------------|
+| πŸ¦‰ | owl | owl | `[[0(10)]]` | $\lambda ab.b(ab)$ |
+| πŸ¦… | eagle | eagle | `[[[[[43(210)]]]]]` | $\lambda abcde.ab(cde)$ |
+| πŸͺ½ | wing | phoenix | `[[[[3(20)(10)]]]]` | $\lambda abcd.a(bd)(cd)$ |
+| πŸ•ŠοΈ | dove | dove | `[[[[32(10)]]]]` | $\lambda abcd.ab(cd)$ |
+| 🦜 | parrot | mockingbird | `[00]` | $\lambda a.aa$ |
+| πŸ¦† | duck | quacky | `[[[0(12)]]]` | $\lambda abc.c(ba)$ |
+| 🐀 | touring chick | turing | `[[0(110)]]` | $\lambda ab.b(aab)$ |
+| πŸ₯ | kool chick | kestrel | `[[1]]` | $\lambda ab.a$ |
+| 🐣 | hatching chick | quirky | `[[[0(21)]]]` | $\lambda abc.c(ab)$ |
+| 🐦 | simple bird | identity | `[0]` | $\lambda a.a$ |
+| 🦚 | peacock | queer | `[[[1(20)]]]` | $\lambda abc.b(ac)$ |
+| 🦀 | dodo | sage | `[[0(11)][0(11)]]` | $\lambda ab.b(aa)\lambda ab.b(aa)$ |
+| 🐧 | penguin | blackbird | `[[[2(10)]]]` | $\lambda abc.a(bc)$ |
+| 🦒 | swan | substitution | `[[[20(10)]]]` | $\lambda abc.ac(bc)$ |
+| 🦩 | flamingo | cardinal | `[[[201]]]` | $\lambda abc.acb$ |
+
+Lonely/unmatched birbs: πŸ”πŸ¦ƒπŸ“
# Syntax
-- `[birb]+`: Birb (left-associative)
+- `[birb]+`: Birb
- everything else: Comment
+# Semantics
+
+Birbs stagger as they walk: they are reduced in alternating associative
+order, starting with birb index $\lfloor\frac{\texttt{len}}{2}\rfloor$:
+
+ 🐦🐦 -> (🐦🐦)
+ 🐦🐦🐦 -> ((🐦🐦)🐦)
+ 🐦🐦🐦🐦 -> (🐦((🐦🐦)🐦))
+ 🐦🐦🐦🐦🐦 -> ((🐦((🐦🐦)🐦))🐦)
+ 🐦🐦🐦🐦🐦🐦 -> (🐦((🐦((🐦🐦)🐦))🐦))
+ 🐦🐦🐦🐦🐦🐦🐦 -> ((🐦((🐦((🐦🐦)🐦))🐦))🐦)
+
# Examples
-## Biology
+You can find more examples in the `samples/` directory.
+
+## Relationships
-- πŸ”πŸ” $\rightsquigarrow$ 🐣
-- πŸͺΆπŸ¦œ $\rightsquigarrow$ 🦚
+- πŸ¦‰πŸ¦ $\rightsquigarrow$ 🦜
- 🦒🐦 $\rightsquigarrow$ πŸ¦‰
-- πŸ¦’πŸ¦†πŸ¦† $\rightsquigarrow$ 🐦
-- 🦒🐦🐦 $\rightsquigarrow$ πŸ”
-- 🦜🐀 $\rightsquigarrow$ πŸ₯
-- 🦜🦜 $\rightsquigarrow$ πŸ•ŠοΈ
-- 🐧🐧 $\rightsquigarrow$ 🐦
+- 🐧🐧 $\rightsquigarrow$ πŸ•ŠοΈ
+- 🦩🐧 $\rightsquigarrow$ 🦚
+- 🦩🦚 $\rightsquigarrow$ 🐧
+
+One can only imagine what happens if two parrots repeat each other: 🦜🦜
+$\rightsquigarrow$ πŸ’₯
## Arithmetic
+For this example I use the Church numerals. Zero would then be encoded
+as πŸ₯🐦. The successor function can be written as 🦒🐧:
+
+- 🐦🐧🐦🦒🐧πŸ₯🐦 $\rightsquigarrow$ λλ(10) – (Church numeral 1)
+- πŸ¦πŸ§πŸ¦πŸ§πŸ•ŠοΈπŸ¦’πŸ§πŸ¦’πŸ§πŸ₯🐦 $\rightsquigarrow$ λλ(1(10)) – (Church numeral
+ 2)
+
+Similarly, one can very obviously translate the Church addition function
+to 🐧🦒πŸ₯πŸ¦’πŸ•ŠοΈ. Now, to calculate $1+2$ based on their increments from
+zero:
+
+- 🦒🐧🦒🐧πŸ₯🐦
+
+Also: 🐧 is $a\cdot b$, 🦜 is $n^n$ and 🦚🐦 $a^b$.
+
+Note that there are many alternative ways to do arithmetic. Try writing
+the functions above with other birbs!
+
## Busy ~~beavers~~ birbs
+- The touring eagle: πŸ¦πŸ¦πŸ¦πŸ¦…πŸ€πŸ¦…πŸ€πŸ¦…πŸ€ (~20M BLC bits)
+- more? PR!
+
+# Usage
+
+Install [Haskell’s
+stack](https://docs.haskellstack.org/en/stable/install_and_upgrade/).
+Then,
+
+- `stack run -- file.birb` or `stack run <(echo 🐧🐧)`
+- `stack install` so you can enjoy `birb` from anywhere
+
+If the output cannot be translated to birbs, the raw lambda calculus
+term (with De Bruijn indices) is printed. For the examples above I
+sometimes manually converted the term back to birbs.
+
# Turing-completeness
The language is probably Turing complete. If the language supported
left- *and* right-associativity, 🐧 would be enough to prove its
completeness.
+
+------------------------------------------------------------------------
+
+The idea of the language was originally proposed in 2021 by an
+unknown(?) author on [Esolang](https://esolangs.org/wiki/Birb).