Computation & Deduction
Spring 1997
Frank Pfenning

The Elf Language

Elf is a constraint logic programming language based on the LF logical framework. An implementation of Elf has been installed for this course for the Sun Sparc and Dec Alpha/OSF1 architectures. If you have Standard ML of New Jersey, versions 93 or 109, you may also consider downloading the Elf distribution and compiling it yourself. Note that Elf has only been tested under Unix at present and will most likely require some minor changes for other operating systems.

Elf Users Guide

A draft of a brief users guide is available in HTML, DVI, PostScript, or PDF format (the latter is searchable, but requires Adobe Acrobat Reader, Version 3.0 or higher). This guide currently only describes the Elf server which is intended to be run as an inferior process to Emacs. At present, this is by far the most efficient way to check signatures and execute Elf code. The installation at CMU is described below.

Running Elf at CMU

The recommended way to run Elf is as an inferior process to Emacs. The version installed at CMU should run on the Sun Sparcs, Sun UltaSparcs, and Dec Alpha machines in the Andrew and CS computing environments under XEmacs (preferred) and FSF Emacs 19. If you have problems, or if you need binaries for another architecture, please drop me a note.

If you have access to the cs.cmu.edu cell on AFS (which should be the case from the andrew.cmu.edu cell), you can simply include the following lines in your .emacs file.

(setq load-path (cons "/afs/cs/user/fp/courses/comp-ded/lib/emacs" load-path))

(autoload 'elf-mode "elf-menus" "Major mode for editing Elf source." t)
(autoload 'elf-server "elf-menus" "Run an inferior Elf server." t)
(autoload 'elfsml "elf-menus" "Run an inferior ElfSML process." t)

(setq auto-mode-alist
      (cons '("\\.elf$" . elf-mode)
            (cons '("\\.quy$" . elf-mode)

(setq elf-server-program "/afs/cs/user/fp/courses/comp-ded/bin/elf-server")
(setq elfsml-program "/afs/cs/user/fp/courses/comp-ded/bin/elfsml")

We show some frequent commands below, in the order they would normally be used. Note that the Elf pull-down menu in the menu-bar references all these commands, which can help when you learn how to use the system.

First, we assume your are browsing the Mini-ML example in directory /afs/cs/user/fp/courses/comp-ded/elf/mini-ml/. We assume your .emacs file is set up as described above and your are visiting the file mini-ml.elf. The current query or declaration refers to the one under the cursor in the current buffer.

M-x elf-server-configure   ; select default CONFIG
C-c C-c                    ; type-check and load current configuration
C-x C-f examples.quy       ; visit example query file
C-c C-e                    ; execute current query

If you are developing your own code, you should set up your own CONFIG file and add to it as you go along. For writing Elf code, you should consider the syntax highlighting which you can enable from the Menu bar in XEmacs (but not in FSF Gnu Emacs). In addition to the commands above, you are also likely to use the following.

Tab                        ; smart indent line
C-c C-s                    ; type-check and load current file only
C-c C-d                    ; type-check current declaration only
C-c `                      ; goto next error location in source
C-c C-i                    ; interrrupt Elf server

Please see the Elf Users Guide or the file /afs/cs/user/fp/courses/comp-ded/lib/emacs/README for further information.

Elf can also be run directly from a shell, but the interface was not designed for it. Please see Elf Users Guide or the file /afs/cs/user/fp/courses/comp-ded/elf/server.txt for further information.

Downloading the Elf Source

Elf is written in Standard ML of New Jersey. You may download (275 K) the current release for SML/NJ, Version 0.93. There have only been minor changes to the Emacs interface since then. There is also a port to SML/NJ, Version 109 (172 K) which, alas, presently does not work with version 109.22 and later. An version of Elf compatible with SML'96 is currently in preparation.

Further Information

  • Home page for Elf
  • Home page on Logical Frameworks

  • [ C&D Home | Schedule | Code | Assignments | Notes | Projects | Elf ]

    © Frank Pfenning 1992-1997