Skip to content
/ glee Public

Experimental Extension of Richard Eisenberg's "Glambda" STLC interpreter with Record Types, Variant Types, and primitive functions

License

Notifications You must be signed in to change notification settings

gnumonik/glee

Repository files navigation

glee

Glee (for Glambda: Extended Edition) is an experimental simply typed lambda calculus interpreter using type-level programming techniques. It is a fork/partial rewrite of Richard Eisenberg's Glambda.

The main modifications to Glambda are:

  1. Switched Int to Peano Nats. (Doesn't really do anything ATM but make it slower, but will need for future experiments)

  2. Added Record Types, Variant Types, a built-in List type, case expressions, and patterns to the language. (To do: Let expressions; Haskell report seems to indicate they can be piggyback'd off of case expressions)

  3. Replaced some of the original singleton-esque GADT code w/ equivalent code that uses the Singletons library. (For improved ergonomics)

  4. Addition of many type-classes, type families, helper GADTs, Data.Constraint Dict-building functions, etc. to facilitate type-safe Records and Variants.

  5. Switched parser library to Megaparsec.

  6. Implemented user-defined types and named functions in the interpreter.

  7. Small syntactical changes. Mainly \x:Nat.x+x -> \x:Nat -> x+x (Haskell style lambdas)

  8. Removed Fix. (Wanted to experiment w/ a non-turing complete language; trivial to re-implement)

  9. Generalized the ArithOps to a set of Op2 operators that don't just work on Ints/Nats. Implemented a few operators on lists/other types.

  10. Implemented a really stupid workaround for the inability to promoting Strings to Symbols. See the Ascii module.

  11. Removed the step command. Something about the way I implemented operators broke it :_(

For right now, that's about it. You should be able to build with either stack build or cabal new-build. I kept getting permission errors w/ cabal and a haskeline dependency after changing linux distributions, but it worked alright before then so I'm guessing that's a me-thing. If you run the executable you get an interpreter that will evaluate STLC expressions. Due to the stupid workaround for string promotion, all function names, type names, record field names, and data constructor names have to contain only upper/lowercase letters or the interpreter will yell at you and crash.

This is still highly experimental, there are a bunch of quirks/errors in the parser, don't rely on it for anything real etc. As of now the point is just to demonstrate a method for type-safe extensions to the STLC.

About

Experimental Extension of Richard Eisenberg's "Glambda" STLC interpreter with Record Types, Variant Types, and primitive functions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published