All Projects → Bubbler-4 → StepULC

Bubbler-4 / StepULC

Licence: MIT license
Efficient and single-steppable ULC evaluation algorithm

Programming Languages

haskell
3896 projects
Dockerfile
14818 projects

Projects that are alternatives of or similar to StepULC

Plam
An interpreter for learning and exploring pure λ-calculus
Stars: ✭ 385 (+2466.67%)
Mutual labels:  interpreter, lambda-calculus
ATS-blockchain
⛓️ Blockchain + Smart contracts from scratch
Stars: ✭ 18 (+20%)
Mutual labels:  interpreter, lambda-calculus
lambda
lambda calculus interpreter
Stars: ✭ 23 (+53.33%)
Mutual labels:  interpreter, lambda-calculus
Mikrokosmos
(λ) Educational lambda calculus interpreter
Stars: ✭ 50 (+233.33%)
Mutual labels:  interpreter, lambda-calculus
Tabloid
A minimal programming language inspired by clickbait headlines
Stars: ✭ 235 (+1466.67%)
Mutual labels:  interpreter
Logo
A Logo interpreter written in Swift
Stars: ✭ 207 (+1280%)
Mutual labels:  interpreter
Basic
Basic Interpreter for the ESP8266
Stars: ✭ 206 (+1273.33%)
Mutual labels:  interpreter
Cub
The Cub Programming Language
Stars: ✭ 198 (+1220%)
Mutual labels:  interpreter
NatsuLang
No description or website provided.
Stars: ✭ 96 (+540%)
Mutual labels:  interpreter
Go Pry
An interactive REPL for Go that allows you to drop into your code at any point.
Stars: ✭ 2,747 (+18213.33%)
Mutual labels:  interpreter
Hexagony
A two-dimensional, hexagonal programming language.
Stars: ✭ 228 (+1420%)
Mutual labels:  interpreter
Awklisp
A Lisp interpreter written in Awk.
Stars: ✭ 214 (+1326.67%)
Mutual labels:  interpreter
Mond
A scripting language for .NET Core
Stars: ✭ 237 (+1480%)
Mutual labels:  interpreter
Codi.vim
📔 The interactive scratchpad for hackers.
Stars: ✭ 2,464 (+16326.67%)
Mutual labels:  interpreter
Gobasic
A BASIC interpreter written in golang.
Stars: ✭ 253 (+1586.67%)
Mutual labels:  interpreter
Retina
A regex-based programming language.
Stars: ✭ 202 (+1246.67%)
Mutual labels:  interpreter
Arturo
Simple, expressive & portable programming language for efficient scripting
Stars: ✭ 225 (+1400%)
Mutual labels:  interpreter
Hackide
hackIDE is an online code editor, compiler and interpreter based on Django, powered by HackerEarth API! Go, hack it!
Stars: ✭ 242 (+1513.33%)
Mutual labels:  interpreter
Swift Lispkit
Interpreter framework for Lisp-based extension and scripting languages on macOS and iOS. LispKit is based on the R7RS standard for Scheme. Its compiler generates bytecode for a virtual machine. LispKit is fully implemented in Swift 5.
Stars: ✭ 228 (+1420%)
Mutual labels:  interpreter
Cpython Internals
Dive into CPython internals, trying to illustrate every detail of CPython implementation
Stars: ✭ 3,084 (+20460%)
Mutual labels:  interpreter

StepULC

Efficient and single-steppable ULC (untyped lambda calculus) evaluation algorithm

The algorithm mainly comes from the following PEPM '17 paper:

Berezun, Daniil & Jones, Neil. (2017). Compiling untyped lambda calculus to lower-level code by game semantics and partial evaluation (invited paper). 1-11. 10.1145/3018882.3020004.

Specifically, Semantics 1 through 3 from Chapter 3 of the paper are implemented with certain modifications, in Haskell.

The main objectives of this development are:

  • Directly work with de Bruijn indexes from the start.
  • Avoid cloning and modifying substructures of a ULC expression (semi-compositionality).
  • Allow single-stepping at the algorithm level (tail recursion).
  • Evaluate the normal form, if it exists.
  • Avoid any tricks related to lazy evaluation, so it can be easily ported to other languages (especially imperative ones).

It was highly non-trivial to modify the presented algorithms to the ones that actually evaluate the normal form, but I finally did it by following the incremental transformations as presented in the paper. And the last one, semantic3, avoids all lazy shenanigans like infinite lists and composed functions inside a data structure, so that it can be ported to more imperative languages.

Regarding performance, a (somewhat suboptimal) factorial function was used (fix is the fixpoint combinator, and other named functions are known ones for Church numerals):

fac = fix facFix where
    facFix = \f n. (iszero n) (\f x. f x) (mult n (f (pred n)))

Naive repeated beta reduction takes multiple hundred milliseconds to evaluate fac 4. semantic2 avoids cloning substructures, and takes under 10 milliseconds for the same input. (Exact timings vary wildly, but I observed around x50 ~ x100 speedup.) Further modifications do not improve in terms of execution time in Haskell (semantic3 is 2~4 times slower than semantic2), but they are essential in recovering the "single-steppability" and portability.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].