Skip to content
/ lamb Public

Tiny Pure Functional Programming Language in Rust

License

Notifications You must be signed in to change notification settings

emamoah/lamb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lamb

Tiny Pure Functional Programming Language in Rust. Based on Untyped Lambda Calculus with Normal Order reduction.

This project is based on an original work by Alexey Kutepov which is written in C. Refer to its README for full documentation.

Quick Start

$ rustc -o lamb lamb.rs
$ ./lamb ./std.lamb
...
,---@>
 W-W'
 Enter :help for more info
 @> pair 69 (pair 420 1337)
 RESULT: \f.f 69 (\f.f 420 1337)
 @> xs = pair 69 (pair 420 1337)
 Created binding xs
 @> first xs
 RESULT: 69
 @> second xs
 RESULT: \f.f 420 1337
 @> first (second xs)
 RESULT: 420
 @>

Main difference

This Rust implementation does not feature a garbage collector, but instead takes advantage of Rust's ownership system for memory management. In particular, it wraps expression objects in an Rc, which is a reference-counted pointer. The object is freed automatically when all references go out of scope. See the Rust documentation for more information.

Shortfalls

  • This version does not currently handle "SIGINT" signals on unix systems. Since Rust doesn't yet have built-in abstractions for signal handling, I'm torn between using a recommended library (introducing excess code I don't fully understand), or writing one myself (incredibly onerous, but educational). At this point, I'm keeping it simple. Ctrl-C just quits the program.

  • This hasn't yet been tested on Windows.

Why I made this

Practice, self-education, and skill improvement.

Feedback

If you try this out and find an error or inconsistency, feel free to open an issue.

About

Tiny Pure Functional Programming Language in Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages