GitHunt
NO

nos1dot618/lambda-discipline

Functional-Programming-Language based on Lambda-Calculus.

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++.


Getting Started

Prerequisites

  • CMake (version 3.16+ recommended)
  • Python 3.8+ (for development environment and tooling)
  • A C++17 capable compiler (e.g. g++, clang++, or MSVC on Windows)

Setup

bash ./scripts/build.sh

Run Golden Tests

bash ./tests/run_tests.sh

Samples

Booleans 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: Any.
    \thenClause: Any. \elseClause: Any.
        (condition thenClause elseClause)

boolToString: Bool = \bool: Bool. (if bool "true" "false")

(print (boolToString true) "\n")
(print (boolToString false) "\n")
$ ./cmake-build-debug/lbd -f  ./examples/conditional_branching.lbd
true
false

Shapes Demo

-- Define Pi as constant
pi: Float = 3.14

-- Define function to calculate square
square: Float -> Float = \x: Float. (mul x x)

-- Define function to calculate area of circle
areaOfCircle: Float -> Float = \r: Float.
    (mul pi (square r))

-- Define function to calculate volume of cylinder
volumeOfCylinder: Float -> Float -> Float = \r: Float.
	  \h: Float. (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 -f ./examples/shapes.lbd
Volume of cylinder is: 785.000000

Fibonacci

fibonacci: Any = \num: Float.
    (null (cmp 0 num) 0
        (null (cmp 1 num) 1
            (add (fibonacci (sub num 1.0)) (fibonacci (sub num 2.0)))))

(print (fibonacci 10))
$ ./cmake-build-debug/lbd -f ./examples/math_demos.lbd
55.000000

Usage

After building, you can run the interpreter with:

lbd [options]

Options

-f, --file <filepath>   Specify input source filepath to run
-h, --help              Show this help message and exit
-d, --debug             Enable debug mode
-r, --repl              Run in interactive REPL node
--docs                  Generate language-reference-document

Generate the language-reference-document by using the --docs flag, and use it as the source of truth for
native-function-signatures.

Editor Plugins

  1. GNU Emacs

Dependencies

  1. readline: For better REPL user experience.

Languages

C++92.0%Emacs Lisp4.2%Shell2.2%CMake1.3%PowerShell0.3%

Contributors

Created December 15, 2025
Updated March 22, 2026
nos1dot618/lambda-discipline | GitHunt