Skip to content

yamacir-kit/meevax

Repository files navigation

Overview

Programming languages should be designed not by piling feature on top of feature, but by removing the weaknesses and restrictions that make additional features appear necessary.

Revised7 Report on the Algorithmic Language Scheme

Meevax is an implementation of Lisp-1 programming language, supporting the latest Scheme language standard and some SRFIs (SRFI; Scheme requests for implementation). This implementation is focused on integration with modern C++ and practicality: it not only works as an interpreter with support for the latest Scheme standard, but also provides a flexible Lisp-1 kernel as a C++ library. The library is installed as a CMake package for easy linking, and any C++ classes can be used from Lisp-1 scripts via simple stubs.

Features

  • Traditional SECD machine [2].
  • Low-level hygienic macro system, known as syntactic closures [4, 6] and explicit renaming [5]. For these, the well-known macro transformers sc-macro-transformer, rsc-macro-transformer and er-macro-transformer from the library (meevax macro-transformer) are provided. Note that these are non-Scheme standards.
  • C++ friendly precise garbage collection [10, 11]

Standards

Meevax can be used as an interpreter that supports the Scheme standard specified by the following report:

  • Revised4 Report on the Algorithmic Language Scheme (R4RS) [5]
  • Revised5 Report on the Algorithmic Language Scheme (R5RS) [9]
  • Revised7 Report on the Algorithmic Language Scheme (R7RS) [13]

Procedures for each standard are provided by the following R7RS-style libraries:

Language Library name
R4RS (scheme r4rs)
R5RS (scheme r5rs)
R7RS (scheme base) (scheme box) (scheme case-lambda) (scheme char) (scheme complex) (scheme cxr) (scheme eval) (scheme file) (scheme flonum) (scheme inexact) (scheme lazy) (scheme list) (scheme load) (scheme process-context) (scheme read) (scheme repl) (scheme time) (scheme write)

SRFIs

Number Title Library name Note
0 Feature-based conditional expansion construct (srfi 0) R7RS 4.2.1
1 List Library (srfi 1) (scheme list)
4 Homogeneous numeric vector datatypes (srfi 4) R7RS 6.9
6 Basic String Ports (srfi 6) R7RS 6.13
8 receive: Binding to multiple values (srfi 8)
9 Defining Record Types (srfi 9) R7RS 5.5
10 #, external form
11 Syntax for receiving multiple values (srfi 11) R7RS 4.2.2
16 Syntax for procedures of variable arity (srfi 16) R7RS 4.2.9
23 Error reporting mechanism (srfi 23) R7RS 6.11
30 Nested Multi-line Comments R7RS 2.2
31 A special form rec for recursive evaluation (srfi 31)
34 Exception Handling for Programs (srfi 34) R7RS 6.11
38 External Representation for Data With Shared Structure (srfi 38) R7RS 6.13.3
39 Parameter objects (srfi 39) R7RS 4.2.6
45 Primitives for Expressing Iterative Lazy Algorithms (srfi 45) R7RS 4.2.5
62 S-expression comments R7RS 2.2
78 Lightweight testing (srfi 78) Except check-ec
87 => in case clauses R7RS 4.2.1
98 An interface to access environment variables (srfi 98) R7RS 6.14
111 Boxes (srfi 111) (scheme box)
144 Flonums (srfi 144) (scheme flonum)
149 Basic syntax-rules template extensions (srfi 149) R7RS 4.3.2

Installation

Requirements

Releases

Latest release is here.

Instruction

First, generate a Makefile using CMake with the following command:

cmake -B build -DCMAKE_BUILD_TYPE=Release
cd build

Then, select one of the following targets and make it according to your purpose. In most cases, make install will be the one you choose.

Target Description
all Build shared-library libmeevax.0.5.304.so and executable meevax.
install Copy files into /usr/local directly.
package Generate debian package meevax_0.5.304_amd64.deb (only Ubuntu). The generated package can be installed by sudo apt install build/meevax_0.5.304_amd64.deb.
test Test executable meevax. This target requires Valgrind to be installed.
uninstall Remove files copied to /usr/local directly by target install.

Usage

Usage:
  meevax [OPTION...] [FILE...]

Options:
  -e, --evaluate=STRING  read and evaluate STRING on interaction-environment
  -h, --help             display this help and exit
  -i, --interactive      enter an interactive session
  -l, --load=FILE        load FILE into interaction-environment
  -v, --version          display version information and exit
  -w, --write=STRING     same as `(write (read STRING))`

License

See LICENSE.

References

[1] John McCarthy. Recursive functions of symbolic expressions and their computation by machine, Part I. Communications of the ACM, 3(4):184--195, 1960.

[2] Peter J. Landin. The Mechanical Evaluation of Expressions. The Computor Journal, 6(4):308--320, 1964.

[3] Peter Henderson. Functional Programming: Application and Implementation. Prentice Hall, 1980.

[4] Alan Bawden and Jonathan Rees. Syntactic Closures. In LFP '88: Proceedings of the 1988 ACM Conference on LISP and Functional Programming, pages 86--95, 1988.

[5] William Clinger and Jonathan Rees (Editors). Revised4 Report on the Algorithmic Language Scheme. ACM SIGPLAN LISP Pointers, IV(3):1--55, 1991.

[6] Chris Hanson. A Syntactic Closures Macro Facility. ACM SIGPLAN LISP Pointers, IV(4):9--16, 1991.

[7] William Clinger. Hygienic Macros Through Explicit Renaming. ACM SIGPLAN LISP Pointers, IV(4):25--28, 1991.

[8] William Clinger and Jonathan Rees. Macros That Work. In POPL '91: Proceedings of the 18th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 155--162, 1991.

[9] Rechard Kelsey, William Clinger, and Jonathan Rees (Editors). Revised5 Report on the Algorithmic Language Scheme. ACM SIGPLAN Notices, 33(9):26--76, 1998.

[10] William E. Kempf. A garbage collection framework for C++, 2001.

[11] William E. Kempf. A garbage collection framework for C++ - Part II, 2001.

[12] Michael D. Adams and R. Kent Dybvig. Efficient Nondestructive Equality Checking for Trees and Graphs. In ICFP '08: Proceedings of the 13th ACM SIGPLAN International Conference on Functional Programming, pages 179--188, 2008.

[13] Alex Shinn, John Cowan, and Arthur A. Gleckler (Editors). Revised7 Report on the Algorithmic Language Scheme. Technical report, http://www.scheme-reports.org/, 2013.