wavelength-ide / wavelength-ide

A browser-based IDE for the untyped lambda calculus. Try it:

Home Page:https://pp.ipd.kit.edu/lehre/misc/lambda-ide/Wavelength.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wavelength

Wavelength is THE IDE for the world's most awesome programming language : the untyped lambda calculus.

Getting started

Lambda expressions can be written into the editor the usual way

(\x.x) y

or by using the unicode lambda symbol.

(λx.x) y

You may also define custom aliases for terms or use predefined library terms by selecting a library in the main menu .

id = (λx.x)

Insert comments to clearify your code.

-- welcome to wavelength

Evaluate your input by pressing . The result and all steps leading to the result will be displayed in the output area beneath the editor.

Congrats, you just evaluated your first lambda expression!

Advanced Usage

Execution control

Instead of evaluating the lambda term from beginning to end with one click, you can step through the evaluation manually by using the and buttons, or by clicking a reducible expression (redex) in the output area (only possible if unicode output format is selected).

Pressing or CTRL + ENTER will always start the execution from the beginning, whereas will run the execution from the current point of execution. will pause a running execution, allowing you to step manually.

Use or CTRL + BACKSPACE to clear the output area.

Output format

You can choose between two display formats, either unicode or syntax trees, by selecting the dedicated option in the left-most combobox beneath the editor.
The output format cannot be changed during an ongoing execution.

The default output format is unicode output, which will display the terms using the unicode lambda symbol (λ).
The redex that will be reduced next (concerning the selected reduction order) is underlined.
Blue highlighted terms can be reduced manually by clicking on them.
The reduced redex will be underlined when the new term is displayed.

In syntax trees light blue nodes indicate a redex and the dark blue node is the redex that will be evaluated next concerning the selected reduction order.

Reduction order

To change the reduction order for the execution process select the desired option in the combobox in the middle. All common orders of the untyped lambda calculus are provided.
Selecting a new reduction order while stepping manually will affect the execution process.

Output size

In case you do not want to get every step of the execution displayed you can change the output size with the right-most combobox.

Full: Every step of the execution is displayed.
Periodically: Every 50th step of the execution is displayed.
Shortened: Only the first and last 10 steps are displayed.
Result only: Only the result is displayed.

Libraries

To improve your programming experience you can include different libraries by selecting them in the main menu . Press CTRL + SPACE in the editor to view the available predefined terms.

Church Boolean
  • true
  • false
  • and
  • or
  • not
  • ifThenElse
Natural Numbers

Allows you to use arabic numerals in the input. All arithmetic operations provided are prefix expressions.

  • plus: takes two arguments n and m, calculates n + m
  • minus: takes two arguments n and m, calculates n - m
  • times: takes two arguments n and m, calculates n * m
  • pow: takes two arguments n and m, calculates nm
  • pred: takes one argument and calculates its predecessor
  • succ: takes one argument and calculates its successor
Accelerated Natural Numbers
This library contains the same functionality as Natural Numbers. However, numbers will be displayed as arabic numerals instead of their respective lambda term. Thus arithmetic operations will in general be faster.
Church Tuples and Lists

All provided operations are prefix expressions.

  • true
  • false
  • pair: takes two parameters n and m, constructs a tuple (n,m)
  • first: takes a tuple as parameter and returns the first argument
  • second: takes a tuple as parameter and returns the second argument
  • newList: constructs a new empty singly linked list
  • prepend: takes an element and a list of elements as parameter and sets the element as the lists new head
  • head: takes a list as parameter and returns its first element
  • tail: takes a list as parameter and returns its last element
  • isEmpty: returns true if the list contains no elements
Y-Combinator

Provides the named term Y to use as the Y-Combinator.

Export

To copy the current output in a desired format press beneath the output area and select a predefined format. In the current version plaintext, unicode, LaTeX, Haskell and Lisp are support. Notice that we do not guarantee executable Haskell or Lisp code since it is only a syntactic translation.

URL Serialization

For sharing the current state of the IDE with you friends you can press beneath the output area and copy the generated URL.

Exercises

To test your understanding of the untyped lambda calculus, Wavelength provides different exercises. Each exercise consists of a task description and a sample solution. Just select an exercise in the main menu and master the lambda calculus!

License

Copyright (c) 2017-2018 Muhammet Gümüs, Markus Himmel, Marc Huisinga, Philip Klemens, Julia Schmid, Jean-Pierre von der Heydt

Wavelength is licensed under BSD 3-Clause.

About

A browser-based IDE for the untyped lambda calculus. Try it:

https://pp.ipd.kit.edu/lehre/misc/lambda-ide/Wavelength.html

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Java 96.0%Language:HTML 2.5%Language:CSS 1.5%Language:Shell 0.0%Language:Batchfile 0.0%