﻿

                  Lambda * Magica      ver 3.60

         Untyped Lambda Calculus Interpreter for Education

        Copyright (C) 2011-2012 Yuuki.S All Rights Reserved.


1. Introduction

  An interpreter of untyped lambda calculus.

1.1 Run

  - Windows
      Execute run.bat or lm.jar directly.

  - Linux/Mac
      Execute run.sh or lm.jar directly.

1.2 Run as CUI (old) mode

  To run the interpreter as CUI (old) mode, type following command:

    $ java -cp lm.jar lambda.Main


2. Basics

    M ::= \x.M    - λ-abstraction
        | M M     - application
        | x       - variable
        | <m>     - macro (extended syntax)

  A variable name consists of only one alphabet character (A-Z, a-z).
  So that, you need not to insert any spaces as delimiters between variables.

  When you bound a new variable using a name that already bounded, the new
  name hides the old name (shadowing).
  Therefore an expression \x.(\x.x) doesn't represent \y.(\x.y) but \x.(\y.y).

  To input 'lambda' symbol, use backslash (\) instead of λ.
  It is not a problem that some fonts display backslash as japanese yen symbol.

  It is able to abbreviate abstractions such as \x.\y.xy to \xy.xy.

  Application is left associative.
  This means that an expression 'xyz' represents '(xy)z.'

  To define a macro, input following expression in the interpreter.

    id = \x.x

  After this, you can use <id> instead of (\x.x) in expressions.
  For example, an expression (\y.yy)<id> is computed as follow:

    (\y.yy)<id> --> <id><id>
                --> (\x.x)<id>
                --> <id>
                --> (\x.x)

  Undefined macros are not expanded.
  In the case that all redexes in an expression are undefined macros, the
  expression is redarded as normal form.

  Basic macros commonly used in untyped lambda calculus are defined in
  prelude.lm.txt, attached in the package.
  Type ':l prelude' to load this.


3. System Commands

  Built-in commands.

    :?            - show command help
    :f <expr>     - expand all macros in the expression, and show the result
                    reduction.
    :l <name>     - load macro definitions from a file
    :l            - load all *.lm.txt files in current directory
    :s <n>        - set a number of continuation steps
    :s            - show the number of current continuation steps
    :t (on|off)   - set trace mode
    :t            - show current setting of trace mode
    :m            - list names and expressions of all defined macros
    :clear        - clear all macro definitions
    :pwd          - print working directory
    :short        - toggle abbreviation mode
    :conv         - toggle data abstraction mode
    :q            - quit interpreter


4. Versions

- ver 3.60 (November 23, 2012)
  maintained GUI mode, set GUI mode as default lauch mode
  implemented font resizing
  implemented line editor holding history
  handle StackOverflowError (when calculation diverged) in auto-mode

- ver 3.50 (November 21, 2012)
  implemented GUI mode.
  implemented redex viewer/selector, auto-mode
  revised readme

- ver 3.00 (November 15, 2012)
  maintained, fixed, and improved considerably.

- ver 2.40 (November 3, 2011)
  fix a problem that :l command does not load files.
  fix a problem that reduction stops remaining macros in certain cases.
  add some system commands.

- ver 2.35
  The first
