NORMAL

The first programming language powered by π, probability and pure audacity.

Home
You really want to try NORMAL? Here you go!

Installation and Dependencies

Follow the instructions at our Github repository or use

  1. sudo apt install python3-mpmath
  2. git clone https://github.com/JanKoelzer/normal-lang.git

Python is PSF licensed, MpMath is BSD licensed, NORMAL is MIT licensed.

Hello World!

Run python3 Interpreter.py 26030 6

Wow, you get 42! 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 42.

The Specs

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:

DigitProduction
-NORMAL ::= (λx.M)
0M ::= (M M)
2M ::= (λx.M)
3M ::= (λy.M)
5M ::= x
6M ::= y
4M ::= 0
1M ::= 1
9M ::= if M then M else M
7M ::= (M + M)
8M ::= (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.Mstart
λx.M * Mrule 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)) 6start
6 * (6 + 1)) 6β rule
6 * 7usual 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.