Slide 1

Slide 1 text

Lambda Interpreter @matyo91 20-03-2025 In PHP

Slide 2

Slide 2 text

Why? @matyo91 20-03-2025

Slide 3

Slide 3 text

Define a language that allows process data-flows with functional programming principles “ @matyo91 20-03-2025

Slide 4

Slide 4 text

What is it about ? @matyo91 20-03-2025

Slide 5

Slide 5 text

Alonzo Church ( 1903 - 1995 ) Inventor of Lambda Calculus @matyo91 @matyo91 20-03-2025

Slide 6

Slide 6 text

Church Turing @matyo91 @matyo91 20-03-2025

Slide 7

Slide 7 text

λ x . x + 1 ( λ x . x + 1 ) ( 5 ) = 5 + 1 = 6 @matyo91 @matyo91 20-03-2025 X X + 1

Slide 8

Slide 8 text

λ x . λ y . x+y ( λ x . λ y . x+y ) ( 5 , 6 ) = 5 + 6 = 11 @matyo91 @matyo91 20-03-2025 X X + Y Y

Slide 9

Slide 9 text

There are variables. We got a way to build functions. We can apply functions to each others by providing elements of the language itself. All derivatives of lambda calculus language is something defined in terms of this definition. Lambda Calculus @matyo91 20-03-2025 @matyo91

Slide 10

Slide 10 text

@matyo91 20-03-2025 @matyo91 Functional Programming Haskell

Slide 11

Slide 11 text

Functional Programming in PHP @matyo91 @matyo91 20-03-2025 Grégoire Hébert https://knot.gheb.dev/blog/php- programmation-fonctionnelle

Slide 12

Slide 12 text

Functional Programming in PHP @matyo91 @matyo91 20-03-2025

Slide 13

Slide 13 text

Combinator @matyo91 @matyo91 20-03-2025 Pol Dellaiera https://github.com/loophp/combinator Name Alias Haskell Lambda calculus JS like A Apply $ λab.ab a => b => a(b) B Bluebird . λabc.a(bc) a => b => c => a(b(c)) Blackbird Blackbird ... λabcd.a(bcd) a => b => c => => d => a(b(c) (d)) C Cardinal flip λabc.acb a => b => c => a(c)(b) I Idiot id λa.a a => a

Slide 14

Slide 14 text

Combinator @matyo91 @matyo91 20-03-2025 Name Alias Haskell Lambda calculus JS like K Kestrel const λab.a a => b => a Psi on λabcd.a(bc)(bd) a => b => c => d => a(b(c)) (b(d)) Q Queer (##) λabc.b(ac) a => b => c => b(a(c)) S Starling <*> λabc.ac(bc) a => b => c => a(c)(b(c)) T Thrush (&) λab.ba a => b => b(a)

Slide 15

Slide 15 text

λ x . x @matyo91 20-03-2025 @matyo91 Lambda-PHP Igor Wiedler https://github.com/igorw/lambda-php

Slide 16

Slide 16 text

@matyo91 20-03-2025 @matyo91 Lambda-PHP

Slide 17

Slide 17 text

@matyo91 20-03-2025 @matyo91 Lambda-PHP

Slide 18

Slide 18 text

@matyo91 20-03-2025 @matyo91 Lambda-PHP

Slide 19

Slide 19 text

@matyo91 20-03-2025 @matyo91 Lambda-PHP

Slide 20

Slide 20 text

@matyo91 20-03-2025 @matyo91 Lambda-PHP (bonus) Krivine machine: Alternate interpreter that uses de-bruijn indices (M N, S, E) → (M, (S,(N,E)), E) (λM, (S,N), E) → (M, S, (E,N)) (i+1, S, (E,N)) → (i, S, E) (0, S, (E1,(M,E2))) → (M, S, E2) Binary lambda calculus: Allows encoding lambda calculus programs in binary form which produces extremely small programs. This also defines an I/O mechanism.

Slide 21

Slide 21 text

@matyo91 20-03-2025 @matyo91 Symfony Expression Language Damien Alexandre https://jolicode.com/blog/adding-php- function-to-symfony- expressionlanguage-the-simple-way

Slide 22

Slide 22 text

@matyo91 20-03-2025 @matyo91 Symfony Expression Language

Slide 23

Slide 23 text

:= | | := λ . := @matyo91 20-03-2025 @matyo91 Language Introduction to the Lambda Calculus https://personal.utdallas.edu/~gupta/ courses/apl/lambda.pdf

Slide 24

Slide 24 text

@matyo91 20-03-2025 @matyo91 Compiler Transformation Code Generation Parsing Tokens AST The Super Tiny Compiler https://github.com/jamiebuilds/the- super-tiny-compiler

Slide 25

Slide 25 text

https://github.com/darkwood-com/flow LambdaFlow @matyo91 20-03-2025 @matyo91 Demo

Slide 26

Slide 26 text

@matyo91 20-03-2025 @matyo91 Programming with Nothing Tom Stuart https://tomstu.art/programming-with- nothing

Slide 27

Slide 27 text

Hello! I Am Mathieu Ledru You can contact me at @matyo91 20-03-2025 @matyo91 Thanks! Any questions?