The first programming language powered by π, probability and pure audacity.
HomeFollow the instructions at our Github repository or use
sudo apt install python3-mpmath
git clone https://github.com/JanKoelzer/normal-lang.git
Python is PSF licensed, MpMath is BSD licensed, NORMAL is MIT licensed.
Run python3 Interpreter.py 26030 6
Wow, you get ! How is that? python3 Interpreter.py runs the interpreter. It takes
two arguments. The first argument is your code, the position of the digits of π you want to start with. In this case,
we start at position 26030 that defines our function: (λx.(x * (x + 1))).
The second argument – 6 – is the input to our function. So the interpreter gets 6 * (6 + 1)
and evaluates it to .
Given an input number n > 0, the NORMAL interpreter examines the n-th decimal digit of π = 3.14159265… This digit is interpreted as a grammar symbol for a recursively expanding grammar defining the untyped lambda calculus with conditionals and integer constants (see below). Whenever a non-terminal symbol is encountered, subsequent digits of π are consumed until a complete lambda expression is produced.
Digits are mapped as follows:
| Digit | Production |
|---|---|
| - | NORMAL ::= (λx.M) |
| 0 | M ::= (M M) |
| 2 | M ::= (λx.M) |
| 3 | M ::= (λy.M) |
| 5 | M ::= x |
| 6 | M ::= y |
| 4 | M ::= 0 |
| 1 | M ::= 1 |
| 9 | M ::= if M then M else M |
| 7 | M ::= (M + M) |
| 8 | M ::= (M * M) |
Using the example above (26030) we have to consider the digits π = 3.14…85751… where 8 is the 26030th digit of π. We then get the following derivation:
| λx.M | start | |
| → | λx.M * M | rule 8 |
| → | λx.(x * M) | rule 5 |
| → | λx.(x * (M + M) | rule 7 |
| → | λx.(x * (x + M) | rule 5 |
| → | λx.x * (x + 1) | rule 1 |
The resulting lambda term (if any) is then applied to the argument (e.g. 6) and evaluated using
call by value semantics:
| (λx.x * (x + 1)) 6 | start | |
| → | 6 * (6 + 1)) 6 | β rule |
| → | 6 * 7 | usual arithmetics |
| → | 42 |
That's it. That's NORMAL. The most accessible way to use lambda calculus! No small print needed.
Small print: NORMAL is what the official implementation tells you it is. Any complaints will be ignored. Also, see our glorious paper that hopefully does not contradict the implementation.