An Interactive Lambda Calculus Interpreter and Visualization Tool
摘要
Lambda Calculus forms the foundational basis for all functional programming languages. In addition, since most other modern programming languages are slowly incorporating functional features such as higher-order functions, lambda expressions, and combinatory logic operators, one can argue that a basic understanding of Lambda Calculus is necessary for modern computer scientists. Typically, Lambda Calculus is introduced in the undergraduate Computer Science curriculum in the Programming Languages Concepts, Programming Paradigms, or Functional Programming courses. In this paper, we present a command-line tool and an interactive Web visualization tool that provide a platform for the student to learn to formulate and evaluate lambda expressions. In the command-line tool, the user can compute free-variables in lambda expressions, perform alpha-reductions and substitutions, and simplify lambda expressions using beta-reductions. This interface is convenient for evaluating lambda expressions to its most reduced form by going through a series of beta-reductions. In the visualization tool, the user inputs a lambda expression and interactively evaluates the expressions, one beta-reduction at a time. The lambda expression is shown in the form of an expression tree, with ready to execute function application nodes shown in green. The student can click on any of these green nodes to perform a beta reduction and the resulting tree is shown. The student can also go back to any of the previous trees to try other beta reductions. The tool was validated in an offering of the Programming Language Concepts class and results from the study are presented in the paper.