Skip to content

CoCoSol007/lambca

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Lambca (Lambda calculus) is a very tiny DSL to manipulate lambda calculus terms. The syntax is very simple. And the project itself is very minimalist.

This project is a personal exploration, created with the goal of discovering and experimenting with new concepts in lambda calculus. It is not meant to be a complete implementation, but rather a minimalist playground for learning.

Syntax

  • Variable: x, y, foo …
  • Abstraction: \x. M (function taking x and returning M)
  • Application: (M N) (apply function M to argument N)

Available commands:

  • Define a term: let = <lambda_term>
  • Evaluate a term: eval <lambda_term> (beta-reduce until no more steps & print the result)

Examples

let id = \x. x
eval (id z)                     // => z

let self = \s. (s s)
eval (self self)                // => (\s.(s s) \s.(s s))

let k = \x.\y. x
eval ((k a) b)                  // => a

let flip = \f.\x.\y. ((f y) x)
eval (((flip id) p) q)          // => (q p)

let chain = \f.\g.\x. (f (g x))
eval (((chain id) id) r)        // => r

you can find more "concrete" examples in the examples folder.

Running

You simply need to run lambca <FilePath>

Installation

If you have cargo installed, you can run cargo install lambca. Otherwise, you can install the binary file from the releases page.

About

A tiny Lambda Calculus DSL

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages