Functional Programming Language based on Lambda Calculus highly inspired by this video Programming with Math | The Lambda Calculus - Eyesomorphic made from scratch, entirely in
C++.
- CMake (version 3.20+ recommended)
- A C++20 capable compiler (e.g.
g++,clang++, orMSVCon Windows)
python make.py setup
python make.py testBooleans and If-Then construct built entirely using Lambda Expressions.
true: Bool = \x: Any. \y: Any. x false: Bool = \x: Any. \y: Any. y if: Any = \condition: Bool. \thenClause: Any. \elseClause: Any. (condition thenClause elseClause) boolToString: String = \bool: Bool. (if bool "true" "false") (print (boolToString true) "\n") (print (boolToString false) "\n")
$ ./cmake-build-debug/lbd run ./examples/conditional_branching.lbd true false
Shapes Demo
-- Define Pi as constant pi: Number = 3.14 -- Define function to calculate square square: Number -> Number = \x: Number. (mul x x) -- Define function to calculate area of circle areaOfCircle: Number -> Number = \r: Number. (mul pi (square r)) -- Define function to calculate volume of cylinder volumeOfCylinder: Number -> Number -> Number = \r: Number. \h: Number. (mul (areaOfCircle r) h) -- Calculate the volume of a cylinder (print "Volume of cylinder is: " (volumeOfCylinder 5.0 10.0) "\n")
$ ./cmake-build-debug/lbd run ./examples/shapes.lbd Volume of cylinder is: 785.000000
Fibonacci
fibonacci: Number = \num: Number. (null (cmp 0 num) 0 (null (cmp 1 num) 1 (add (fibonacci (sub num 1.0)) (fibonacci (sub num 2.0))))) (print (fibonacci 10) "\n")
$ ./cmake-build-debug/lbd run ./examples/math_demos.lbd 55.000000
After building, you can run the interpreter with:
lbd [subcommands] <options>
OPTIONS:
-h, --help Print this help message and exit
-d, --debug
SUBCOMMANDS:
run Run a Lambda Discipline source file
docs Generate native function signatures for reference
repl Start an interactive Read-Eval-Print Loop (REPL)
Generate the language-reference-document by using the
docssubcommand, and use it as the source of truth for native-function-signatures.
Prebuilt Linux releases are distributed as AppImages, allowing the interpreter to run on most modern Linux distributions without installation.
You can download the latest release from the GitHub Releases page.
After downloading an AppImage, make it executable and run it:
chmod +x Lambda_Discipline-*.AppImage ./Lambda_Discipline-*.AppImage --help
You can also integrate the AppImage with your desktop environment using tools such as
AppImageLauncher, or simply keep it as a portable executable.